Index.cshtml 2.8 KB

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