public OngViewModel Atualizar(OngViewModel ongViewModel) { var ong = Mapper.Map <Ong>(ongViewModel); _ongService.Atualizar(ong); ong.Ativo = true; Commit(); return(ongViewModel); }
public IActionResult Atualizar(OngViewModel ongViewModel, int id) { if (id != ongViewModel.Id) { NotificarErro("Os ids informados não são idênticos!"); Retorno(); } if (!ModelState.IsValid) { return(Retorno(ongViewModel)); } return(Retorno(_ongService.Atualizar(ongViewModel, id))); }
public IActionResult Editar(int id, OngViewModel ong) { if (id != ong.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _ongService.Atualizar(ong, id); } catch (DbUpdateConcurrencyException) { throw; } return(RedirectToAction(nameof(Index))); } return(View(ong)); }