0

In this case there are two tables. One is item info another is item commission. In item table there are three columns - item ID, item name and price. In the item commission table there are three columns commission ID, item ID and rate of commission. In the view I need to show item name from the item info table and rate of commission from item commission table. In this case I have used linq for joining two tables.

I made a list and want to show it in view in mvc5 but get an error. Here is the code:

@model IEnumerable<FRANCHISEE.Models.FrcItemList>

@{
    ViewBag.Title = "FranchiseeItemList";
}
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ItemName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Roc)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FrcItemId)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.ItemName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Roc)
            </td>

            <td>
                @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
                @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
                @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
            </td>
        </tr>
    }```

1 Answers1

0

I think it has to do with the ActionLink, in which case the correct format is here:

C# MVC 5 Html.ActionLInk

@Html.ActionLink(customer.Name, "CustomerView", "Customer", new { id = item.PrimaryKey }, null)

jet_24
  • 598
  • 3
  • 8