Index.cshtml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. @using CD67.FicheCollege.MVC.Models
  2. @model TerritoireIndexViewModel
  3. @{
  4. ViewBag.Title = "Administration - Les Territoires";
  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. Territoire modele_territoire = new Territoire();
  9. }
  10. <h2>Liste</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>@Html.DisplayNameFor(model => modele_territoire.Id)</th>
  20. <th>@Html.DisplayNameFor(model => modele_territoire.Libelle)</th>
  21. <th>@Html.DisplayNameFor(model => modele_territoire.Referent)</th>
  22. <th></th>
  23. </tr>
  24. @foreach (var item in Model.Obj.OrderBy(i=>i.Ordre))
  25. {
  26. <tr>
  27. <td>@Html.DisplayFor(modelItem => item.Id)</td>
  28. <td>@Html.DisplayFor(modelItem => item.Libelle)</td>
  29. <td>@Html.DisplayFor(modelItem => item.Referent)</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>