Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //POST
- [HttpPost]
- public ActionResult Create(Projeto projeto)
- {
- PopularViewBag();
- return GravarProjeto(projeto);
- }
- ActionResult GravarProjeto(Projeto projeto)
- {
- try
- {
- if (ModelState.IsValid)
- {
- projetoServico.GravarProjeto(projeto);
- return RedirectToAction("Create", "Integrante");
- }
- return View(projeto);
- }
- catch
- {
- return View(projeto);
- }
- }
- @model Modelo.Projeto
- @using (Html.BeginForm())
- {
- @Html.AntiForgeryToken()
- <div class="form-horizontal">
- <h4 style="text-align: center">Criar Projeto</h4>
- <hr />
- @Html.ValidationSummary(true, "", new { @class = "text-danger" })
- @*<div style="margin-bottom: 25px; align-content: center" class="input-group">*@
- <span class="input-group-addon">
- <i class="glyphicon
- glyphicon-user"></i>
- </span>
- @Html.EditorFor(model => model.ProjetoNome, new { htmlAttributes = new { @class = "text-body", placeholder = "Nome do Projeto", autofocus = true } })
- @Html.ValidationMessageFor(model => model.ProjetoNome, "", new { @class = "text-danger" })
- @*</div>*@
- <br /><br /><br />
- @*<div style="margin-bottom: 25px" class="input-group">*@
- <span class="input-group-addon">
- <i class="glyphicon
- glyphicon-user"></i>
- </span>
- @Html.TextAreaFor(model => model.ProjetoDescricao, new { htmlAttributes = new { @class = "form-control", placeholder = "Descrição do Projeto", autofocus = true } })
- @Html.ValidationMessageFor(model => model.ProjetoDescricao, "", new { @class = "text-danger" })
- @*</div>*@
- @*<div class="form-group">
- @Html.LabelFor(model => model.StatusId, "Status", htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.DropDownList("StatusId", null, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.StatusId, "", new { @class = "text-danger" })
- </div>
- </div>*@
- <br />
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- @*<button class="btn btn-dark">@Html.ActionLink("Próximo", "Create", "Integrante",)</button>*@
- <input type="submit" value="Create" class="btn btn-dark"/>
- </div>
- </div>
- </div>
- }
- @*</div>*@
- <div>
- <button class="btn-link">@Html.ActionLink("Meus Projetos", "Index")</button>
- </div>
- </div>
- //GET
- public ActionResult Create()
- {
- return View();
- }
- //POST
- [HttpPost]
- public ActionResult Create(Integrante integrante)
- {
- return GravarIntegrante(integrante);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement