Create.cshtml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. @model CD67.ModeleMVC.Entity.EXEMPLE_VIKINGS
  2. @{
  3. ViewBag.Title = "Create";
  4. Layout = "~/Views/Shared/_Layout.cshtml";
  5. }
  6. <title>Vikings</title>
  7. <h2>Creation</h2>
  8. @using (Html.BeginForm())
  9. {
  10. @Html.AntiForgeryToken()
  11. <div class="form-horizontal">
  12. <h4>Viking</h4>
  13. <hr />
  14. @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  15. @*Contenu généré mais masqué car inutile, la clé est générée automatiquement dans mon exemple par un trigger/sequence*@
  16. @*<div class="form-group">
  17. @Html.LabelFor(model => model.ID, "ID", htmlAttributes: new { @class = "control-label col-md-2" })
  18. <div class="col-md-10">
  19. @Html.DropDownList("ID", null, htmlAttributes: new { @class = "form-control" })
  20. @Html.ValidationMessageFor(model => model.ID, "", new { @class = "text-danger" })
  21. </div>
  22. </div>*@
  23. <div class="form-group">
  24. @Html.LabelFor(model => model.NOM, htmlAttributes: new { @class = "control-label col-md-2" })
  25. <div class="col-md-10">
  26. @Html.EditorFor(model => model.NOM, new { htmlAttributes = new { @class = "form-control autofocus" } })
  27. @Html.ValidationMessageFor(model => model.NOM, "", new { @class = "text-danger" })
  28. </div>
  29. </div>
  30. @*Liste de choix pour le type, rempli gràce au ViewBag dans le contrôleur*@
  31. @*Liste principale pour la liste imbriquée sous-type*@
  32. <div class="form-group">
  33. @Html.LabelFor(model => model.ID_TYPE, htmlAttributes: new { @class = "control-label col-md-2" })
  34. <div class="col-md-10">
  35. @Html.DropDownList("ID_TYPE", null, htmlAttributes: new { @class = "form-control liste-principale", @data = "/VIKINGS/listeSousType" })
  36. @Html.ValidationMessageFor(model => model.ID_TYPE, "", new { @class = "text-danger" })
  37. </div>
  38. </div>
  39. @*Liste de choix d'un sous-type fictif*@
  40. <div class="form-group">
  41. @Html.LabelFor(model => model.ID_SOUS_TYPE, "Sous type", htmlAttributes: new { @class = "control-label col-md-2" })
  42. <div class="col-md-10">
  43. @Html.DropDownList("ID_SOUS_TYPE", null, htmlAttributes: new { @class = "form-control liste-secondaire" })
  44. @Html.ValidationMessageFor(model => model.ID_SOUS_TYPE, "", new { @class = "text-danger" })
  45. @Html.DescriptionFor(model => model.ID_SOUS_TYPE)
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. @Html.LabelFor(model => model.DESCRIPTION, htmlAttributes: new { @class = "control-label col-md-2" })
  50. <div class="col-md-10">
  51. @Html.EditorFor(model => model.DESCRIPTION, new { htmlAttributes = new { @class = "form-control" } })
  52. @Html.ValidationMessageFor(model => model.DESCRIPTION, "", new { @class = "text-danger" })
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. @Html.LabelFor(model => model.alwaysYes, htmlAttributes: new { @class = "control-label col-md-2" })
  57. <div class="col-md-10">
  58. @Html.EditorFor(model => model.alwaysYes, new { htmlAttributes = new { @class = "form-control" } })
  59. @Html.ValidationMessageFor(model => model.alwaysYes, "", new { @class = "text-danger" })
  60. @Html.DescriptionFor(model=>model.alwaysYes)
  61. </div>
  62. </div>
  63. <div class="form-group">
  64. @Html.LabelFor(model => model.alwaysNo, htmlAttributes: new { @class = "control-label col-md-2" })
  65. <div class="col-md-10">
  66. @Html.EditorFor(model => model.alwaysNo, new { htmlAttributes = new { @class = "form-control" } })
  67. @Html.ValidationMessageFor(model => model.alwaysNo, "", new { @class = "text-danger" })
  68. @Html.DescriptionFor(model => model.alwaysNo)
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. @Html.LabelFor(model => model.DATE_INUTILE, htmlAttributes: new { @class = "control-label col-md-2" })
  73. <div class="col-md-10">
  74. @Html.EditorFor(model => model.DATE_INUTILE, new { htmlAttributes = new { @class = "form-control" } })
  75. @Html.ValidationMessageFor(model => model.DATE_INUTILE, "", new { @class = "text-danger" })
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <div class="col-md-offset-2 col-md-10">
  80. <input type="submit" value="Ajouter" class="btn btn-success" />
  81. <input type="reset" value="Annuler" class="btn btn-default" />
  82. </div>
  83. </div>
  84. </div>
  85. }
  86. <div>
  87. @*Message d'alerte au retour sur la page précédente*@
  88. <a href="#" onclick="Annulation('@Url.Action("Index")')">Retour</a>
  89. </div>