Index.cshtml 2.5 KB

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