Create.cshtml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. @model CD67.ModeleMVC.Entity.EXEMPLE_VIKINGS
  2. @{
  3. ViewBag.Title = "Create";
  4. Layout = "~/Views/Shared/_AppLayout.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" } })
  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. <div class="form-group">
  32. @Html.LabelFor(model => model.ID_TYPE, htmlAttributes: new { @class = "control-label col-md-2" })
  33. <div class="col-md-10">
  34. @Html.DropDownList("ID_TYPE", null, htmlAttributes: new { @class = "form-control" })
  35. @Html.ValidationMessageFor(model => model.ID_TYPE, "", new { @class = "text-danger" })
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. @Html.LabelFor(model => model.DESCRIPTION, htmlAttributes: new { @class = "control-label col-md-2" })
  40. <div class="col-md-10">
  41. @Html.EditorFor(model => model.DESCRIPTION, new { htmlAttributes = new { @class = "form-control" } })
  42. @Html.ValidationMessageFor(model => model.DESCRIPTION, "", new { @class = "text-danger" })
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. @Html.LabelFor(model => model.alwaysYes, htmlAttributes: new { @class = "control-label col-md-2" })
  47. <div class="col-md-10">
  48. @Html.EditorFor(model => model.alwaysYes, new { htmlAttributes = new { @class = "form-control" } })
  49. @Html.ValidationMessageFor(model => model.alwaysYes, "", new { @class = "text-danger" })
  50. @Html.DescriptionFor(model=>model.alwaysYes)
  51. </div>
  52. </div>
  53. <div class="form-group">
  54. @Html.LabelFor(model => model.alwaysNo, htmlAttributes: new { @class = "control-label col-md-2" })
  55. <div class="col-md-10">
  56. @Html.EditorFor(model => model.alwaysNo, new { htmlAttributes = new { @class = "form-control" } })
  57. @Html.ValidationMessageFor(model => model.alwaysNo, "", new { @class = "text-danger" })
  58. @Html.DescriptionFor(model => model.alwaysNo)
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <div class="col-md-offset-2 col-md-10">
  63. <input type="submit" value="Ajouter" class="btn btn-success" />
  64. <input type="reset" value="Annuler" class="btn btn-default" />
  65. </div>
  66. </div>
  67. </div>
  68. }
  69. <div>
  70. @Html.ActionLink("Retour", "Index")
  71. </div>