samedi 1 décembre 2018

Display category description (one time) in a list of product in asp.net mvc

i have a list in the model of one sale, and i display all products in it, but, now i need to display the category description, (one time) for each products from the seame category, how can be done?

Product Quantity Price *Licors Brugal 1 500 Barcelo 15 700 *Fruits Apple 1 25 Banana 3 5

This is my code

<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>




Aucun commentaire:

Enregistrer un commentaire