Index.cshtml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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>
  18. @Html.DisplayNameFor(model => model.Libelle)
  19. </th>
  20. <th>
  21. @Html.DisplayNameFor(model => model.Referent)
  22. </th>
  23. <th></th>
  24. </tr>
  25. @foreach (var item in Model)
  26. {
  27. <tr>
  28. <td>
  29. @Html.DisplayFor(modelItem => item.Libelle)
  30. </td>
  31. <td>
  32. @Html.DisplayFor(modelItem => item.Referent)
  33. </td>
  34. <td>
  35. @if (row != 1)
  36. {
  37. <a href="@Url.Action("Up", new { id = item.Id })">
  38. <span class="glyphicon glyphicon-circle-arrow-up fa-2x color1" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
  39. </a>
  40. }
  41. else
  42. {
  43. <span class="glyphicon glyphicon-circle-arrow-up fa-2x color2" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
  44. }
  45. @if (item.Ordre != maxOrdre)
  46. {
  47. <a href="@Url.Action("Down", new { id = item.Id })">
  48. <span class="glyphicon glyphicon-circle-arrow-down fa-2x color1" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
  49. </a>
  50. }
  51. else
  52. {
  53. <span class="glyphicon glyphicon-circle-arrow-down fa-2x color2" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
  54. }
  55. <a href="@Url.Action("Edit", new { id = item.Id })">
  56. <span class="glyphicon glyphicon-edit fa-2x color1" title="Modifier" style="vertical-align: middle" aria-hidden="true"></span>
  57. </a>
  58. <a href="@Url.Action("Delete", new { id = item.Id })">
  59. <span class="glyphicon glyphicon-remove-sign fa-2x color1" title="Supprimer" style="vertical-align: middle" aria-hidden="true"></span>
  60. </a>
  61. </td>
  62. </tr>
  63. row += 1;
  64. }
  65. </table>