Index.cshtml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @model IEnumerable<CD67.FicheCollege.Entity.TypeCollege>
  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></th>
  21. </tr>
  22. @foreach (var item in Model)
  23. {
  24. <tr>
  25. <td>
  26. @Html.DisplayFor(modelItem => item.Libelle)
  27. </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>