Create.cshtml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @model CD67.ModeleMVC.Entity.EXEMPLE_VIKINGS
  2. @{
  3. ViewBag.Title = "Create";
  4. Layout = "~/Views/Shared/_AppLayout.cshtml";
  5. }
  6. <h2>Creation</h2>
  7. @using (Html.BeginForm())
  8. {
  9. @Html.AntiForgeryToken()
  10. <div class="form-horizontal">
  11. <h4>Viking</h4>
  12. <hr />
  13. @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  14. @*Contenu généré mais masqué car inutile, la clé est générée automatiquement dans mon exemple par un trigger/sequence*@
  15. @*<div class="form-group">
  16. @Html.LabelFor(model => model.ID, "ID", htmlAttributes: new { @class = "control-label col-md-2" })
  17. <div class="col-md-10">
  18. @Html.DropDownList("ID", null, htmlAttributes: new { @class = "form-control" })
  19. @Html.ValidationMessageFor(model => model.ID, "", new { @class = "text-danger" })
  20. </div>
  21. </div>*@
  22. <div class="form-group">
  23. @Html.LabelFor(model => model.NOM, htmlAttributes: new { @class = "control-label col-md-2" })
  24. <div class="col-md-10">
  25. @Html.EditorFor(model => model.NOM, new { htmlAttributes = new { @class = "form-control" } })
  26. @Html.ValidationMessageFor(model => model.NOM, "", new { @class = "text-danger" })
  27. </div>
  28. </div>
  29. @*Liste de choix pour le type, rempli gràce au ViewBag dans le contrôleur*@
  30. <div class="form-group">
  31. @Html.LabelFor(model => model.ID_TYPE, htmlAttributes: new { @class = "control-label col-md-2" })
  32. <div class="col-md-10">
  33. @Html.DropDownList("ID_TYPE", null, htmlAttributes: new { @class = "form-control" })
  34. @Html.ValidationMessageFor(model => model.ID_TYPE, "", new { @class = "text-danger" })
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. @Html.LabelFor(model => model.DESCRIPTION, htmlAttributes: new { @class = "control-label col-md-2" })
  39. <div class="col-md-10">
  40. @Html.EditorFor(model => model.DESCRIPTION, new { htmlAttributes = new { @class = "form-control" } })
  41. @Html.ValidationMessageFor(model => model.DESCRIPTION, "", new { @class = "text-danger" })
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. @Html.LabelFor(model => model.alwaysYes, htmlAttributes: new { @class = "control-label col-md-2" })
  46. <div class="col-md-10">
  47. @Html.EditorFor(model => model.alwaysYes, new { htmlAttributes = new { @class = "form-control" } })
  48. @Html.ValidationMessageFor(model => model.alwaysYes, "", new { @class = "text-danger" })
  49. @Html.DescriptionFor(model=>model.alwaysYes)
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. @Html.LabelFor(model => model.alwaysNo, htmlAttributes: new { @class = "control-label col-md-2" })
  54. <div class="col-md-10">
  55. @Html.EditorFor(model => model.alwaysNo, new { htmlAttributes = new { @class = "form-control" } })
  56. @Html.ValidationMessageFor(model => model.alwaysNo, "", new { @class = "text-danger" })
  57. @Html.DescriptionFor(model => model.alwaysNo)
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <div class="col-md-offset-2 col-md-10">
  62. <input type="submit" value="Ajouter" class="btn btn-success" />
  63. <input type="reset" value="Annuler" class="btn btn-default" />
  64. </div>
  65. </div>
  66. </div>
  67. }
  68. <div>
  69. @Html.ActionLink("Retour", "Index")
  70. </div>