У меня есть список в модели одной продажи, и я отображаю все продукты в нем, но теперь мне нужно отобразить описание категории (один раз) для каждого продукта из категории шва, как это можно сделать?
Product Quantity Price
*Licors (This is the category)
Brugal 1 500
Barcelo 15 700
*Fruits (This is the category)
Apple 1 25
Banana 3 5
мне нужно показать описание @Html.DisplayFor(modelItem => item.Product.Category.Description)
(вверх) название продукта Это мой код
<table>
<thead>
<tr>
<th class="center"></th>
<th>Serv./Prod.</th>
<th class="center">Cant.</th>
<th class="right">Precio</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.SalesDetails.OrderBy(p=>p.Product.CategoryId))
{
<tr>
<td class="center"></td>
<td class="left"> @Html.DisplayFor(modelItem => item.Product.Name)</td>
<td class="right"> @Html.DisplayFor(modelItem => item.Quantity)</td>
<td class="center"> @Html.DisplayFor(modelItem => item.Product.SellPrice)</td>
</tr>
}
</tbody>
</table>