Index.cshtml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. @using CD67.FicheCollege.MVC.Models
  2. @model AnneeViewModel
  3. @{
  4. ViewBag.Title = "Liste";
  5. Layout = "~/Views/Shared/_Layout.cshtml";
  6. ActionEdu action_model = new ActionEdu();
  7. int maxOrdre = Model.Obj.ActionsEdu.Count() == 0 ? 0 : Model.Obj.ActionsEdu.Max(i => i.Ordre);
  8. int row = 1;
  9. }
  10. <h2>Liste</h2>
  11. <p>
  12. <a href="@Url.Action("Create", new { annee_id = Model.Obj.Id })">
  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 => action_model.Numero)
  21. </th>
  22. <th>
  23. @Html.DisplayNameFor(model => action_model.Nom)
  24. </th>
  25. <th>
  26. @Html.DisplayNameFor(model => action_model.Description)
  27. </th>
  28. <th>
  29. @Html.DisplayNameFor(model => action_model.Neutralise)
  30. </th>
  31. <th>
  32. @Html.DisplayNameFor(model => action_model.ActionEduThematique.ActionEduAxeId)
  33. </th>
  34. <th>
  35. @Html.DisplayNameFor(model => action_model.ActionEduThematiqueId)
  36. </th>
  37. <th></th>
  38. </tr>
  39. @foreach (ActionEdu item in Model.Obj.ActionsEdu.OrderBy(i=>i.Ordre))
  40. {
  41. <tr>
  42. <td>
  43. @Html.DisplayFor(modelItem => item.Numero)
  44. </td>
  45. <td>
  46. @Html.DisplayFor(modelItem => item.Nom)
  47. </td>
  48. <td>
  49. @Html.DisplayFor(modelItem => item.Description)
  50. </td>
  51. <td>
  52. @Html.DisplayFor(modelItem => item.Neutralise)
  53. </td>
  54. <th>
  55. @Html.DisplayFor(model => item.ActionEduThematique.ActionEduAxeId)
  56. </th>
  57. <th>
  58. @Html.DisplayFor(model => item.ActionEduThematiqueId)
  59. </th>
  60. <td>
  61. @if (row != 1)
  62. {
  63. <a href="@Url.Action("Up", new { id = item.Id })">
  64. <span class="glyphicon glyphicon-circle-arrow-up fa-2x color1" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
  65. </a>
  66. }
  67. else
  68. {
  69. <span class="glyphicon glyphicon-circle-arrow-up fa-2x color2" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
  70. }
  71. @if (item.Ordre != maxOrdre)
  72. {
  73. <a href="@Url.Action("Down", new { id = item.Id })">
  74. <span class="glyphicon glyphicon-circle-arrow-down fa-2x color1" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
  75. </a>
  76. }
  77. else
  78. {
  79. <span class="glyphicon glyphicon-circle-arrow-down fa-2x color2" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
  80. }
  81. <a href="@Url.Action("Edit", new { id = item.Id })">
  82. <span class="glyphicon glyphicon-edit fa-2x color1" title="Modifier" style="vertical-align: middle" aria-hidden="true"></span>
  83. </a>
  84. <a href="@Url.Action("Delete", new { id = item.Id })">
  85. <span class="glyphicon glyphicon-remove-sign fa-2x color1" title="Supprimer" style="vertical-align: middle" aria-hidden="true"></span>
  86. </a>
  87. </td>
  88. </tr>
  89. row += 1;
  90. }
  91. </table>