Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. //POST
  2. [HttpPost]
  3. public ActionResult Create(Projeto projeto)
  4. {
  5. PopularViewBag();
  6. return GravarProjeto(projeto);
  7. }
  8.  
  9. ActionResult GravarProjeto(Projeto projeto)
  10. {
  11. try
  12. {
  13. if (ModelState.IsValid)
  14. {
  15. projetoServico.GravarProjeto(projeto);
  16. return RedirectToAction("Create", "Integrante");
  17. }
  18. return View(projeto);
  19. }
  20. catch
  21. {
  22. return View(projeto);
  23. }
  24. }
  25.  
  26. @model Modelo.Projeto
  27.  
  28. @using (Html.BeginForm())
  29. {
  30. @Html.AntiForgeryToken()
  31.  
  32. <div class="form-horizontal">
  33. <h4 style="text-align: center">Criar Projeto</h4>
  34. <hr />
  35. @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  36.  
  37. @*<div style="margin-bottom: 25px; align-content: center" class="input-group">*@
  38. <span class="input-group-addon">
  39. <i class="glyphicon
  40. glyphicon-user"></i>
  41. </span>
  42. @Html.EditorFor(model => model.ProjetoNome, new { htmlAttributes = new { @class = "text-body", placeholder = "Nome do Projeto", autofocus = true } })
  43. @Html.ValidationMessageFor(model => model.ProjetoNome, "", new { @class = "text-danger" })
  44. @*</div>*@
  45. <br /><br /><br />
  46.  
  47.  
  48. @*<div style="margin-bottom: 25px" class="input-group">*@
  49. <span class="input-group-addon">
  50. <i class="glyphicon
  51. glyphicon-user"></i>
  52. </span>
  53. @Html.TextAreaFor(model => model.ProjetoDescricao, new { htmlAttributes = new { @class = "form-control", placeholder = "Descrição do Projeto", autofocus = true } })
  54. @Html.ValidationMessageFor(model => model.ProjetoDescricao, "", new { @class = "text-danger" })
  55. @*</div>*@
  56.  
  57. @*<div class="form-group">
  58. @Html.LabelFor(model => model.StatusId, "Status", htmlAttributes: new { @class = "control-label col-md-2" })
  59. <div class="col-md-10">
  60. @Html.DropDownList("StatusId", null, new { htmlAttributes = new { @class = "form-control" } })
  61. @Html.ValidationMessageFor(model => model.StatusId, "", new { @class = "text-danger" })
  62. </div>
  63. </div>*@
  64.  
  65. <br />
  66. <div class="form-group">
  67. <div class="col-md-offset-2 col-md-10">
  68. @*<button class="btn btn-dark">@Html.ActionLink("Próximo", "Create", "Integrante",)</button>*@
  69. <input type="submit" value="Create" class="btn btn-dark"/>
  70. </div>
  71. </div>
  72. </div>
  73. }
  74. @*</div>*@
  75. <div>
  76. <button class="btn-link">@Html.ActionLink("Meus Projetos", "Index")</button>
  77. </div>
  78. </div>
  79.  
  80. //GET
  81. public ActionResult Create()
  82. {
  83. return View();
  84. }
  85.  
  86. //POST
  87. [HttpPost]
  88. public ActionResult Create(Integrante integrante)
  89. {
  90. return GravarIntegrante(integrante);
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement