public ActionResult <ProjetoViewModel> Post([FromBody] ProjetoViewModel obj) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _projetoAppService.Incluir(obj); } catch (DbUpdateException) { if (ObjExists(obj.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction(nameof(Get), new { id = obj.Id }, obj)); }
public IActionResult OnPost() { if (!ModelState.IsValid) { SelectSistemas = new SelectList(_sistemaAppService.Listar(), "Id", "Nome"); return(Page()); } _projetoAppService.Incluir(Projeto); return(RedirectToPage("Listar")); }