Index.cshtml 2.4 KB

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