Reputation: 21
I am trying to only create one "create new" where it queries the type of the product with it. But i dont know how to access without the @foreach.
@foreach(var item in Model)
{
@Html.ActionLink("Create New Entity", "CreateEntityType", new { EntityTypeEnum = item.EntityTypeEnum})
}
</p>
Upvotes: 0
Views: 677
Reputation: 2379
If your Model is an array and you simply wish to access the first index [0]
for EntityTypeEnum
(or any index) you can do the following.
@Html.ActionLink("Create New Entity", "CreateEntityType", new { EntityTypeEnum = Model[0].item.EntityTypeEnum})
Upvotes: 1