Index.cshtml 2.6 KB

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