Index.cshtml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. @model IEnumerable<CD67.FicheCollege.Entity.Territoire>
  2. @{
  3. ViewBag.Title = "Liste";
  4. Layout = "~/Views/Shared/_Layout.cshtml";
  5. int maxOrdre = Model.Count() == 0 ? 0 : Model.Max(i => i.Ordre);
  6. int row = 1;
  7. }
  8. <h2>Liste</h2>
  9. <p>
  10. <a href="@Url.Action("Create")">
  11. <span class="glyphicon glyphicon-plus-sign fa-2x color1" style="vertical-align: middle" aria-hidden="true"></span>
  12. Créer un nouvel élément
  13. </a>
  14. </p>
  15. <table class="table">
  16. <tr>
  17. <th>@Html.DisplayNameFor(model => model.Id)</th>
  18. <th>@Html.DisplayNameFor(model => model.Libelle)</th>
  19. <th>@Html.DisplayNameFor(model => model.Referent)</th>
  20. <th></th>
  21. </tr>
  22. @foreach (var item in Model)
  23. {
  24. <tr>
  25. <td>@Html.DisplayFor(modelItem => item.Id)</td>
  26. <td>@Html.DisplayFor(modelItem => item.Libelle)</td>
  27. <td>@Html.DisplayFor(modelItem => item.Referent)</td>
  28. <td>
  29. @if (row != 1)
  30. {
  31. <a href="@Url.Action("Up", new { id = item.Id })">
  32. <span class="glyphicon glyphicon-circle-arrow-up fa-2x color1" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
  33. </a>
  34. }
  35. else
  36. {
  37. <span class="glyphicon glyphicon-circle-arrow-up fa-2x color2" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
  38. }
  39. @if (item.Ordre != maxOrdre)
  40. {
  41. <a href="@Url.Action("Down", new { id = item.Id })">
  42. <span class="glyphicon glyphicon-circle-arrow-down fa-2x color1" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
  43. </a>
  44. }
  45. else
  46. {
  47. <span class="glyphicon glyphicon-circle-arrow-down fa-2x color2" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
  48. }
  49. <a href="@Url.Action("Edit", new { id = item.Id })">
  50. <span class="glyphicon glyphicon-edit fa-2x color1" title="Modifier" style="vertical-align: middle" aria-hidden="true"></span>
  51. </a>
  52. <a href="@Url.Action("Delete", new { id = item.Id })">
  53. <span class="glyphicon glyphicon-remove-sign fa-2x color1" title="Supprimer" style="vertical-align: middle" aria-hidden="true"></span>
  54. </a>
  55. </td>
  56. </tr>
  57. row += 1;
  58. }
  59. </table>