Skip to content

Commit

Permalink
Implemented actions for updating a PlanoConta item
Browse files Browse the repository at this point in the history
  • Loading branch information
disouzam committed Dec 20, 2024
1 parent a0596c6 commit 5bf9dcd
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,16 @@ public IActionResult Cadastro(PlanoContaModel? model)
[HttpGet]
[HttpPost]
[Route("Cadastro/{id}")]
public IActionResult Cadastro(int id)
public IActionResult Cadastro(int id, PlanoContaModel? model)
{
if (model != null && ModelState.IsValid && this.Request.Method == "POST")
{
var savedId = planoContaService.Salvar(model);

var savedPlanoContaModel = planoContaService.RetornarRegistro(savedId);
return View(savedPlanoContaModel);
}

var planoContaModel = planoContaService.RetornarRegistro(id);

return View(planoContaModel);
Expand Down

0 comments on commit 5bf9dcd

Please sign in to comment.