public RepresentadaViewModel Atualizar(RepresentadaViewModel representada) { var representadaRetorno = Mapper.Map <RepresentadaViewModel> (_representadaService.Atualizar(Mapper.Map <Representada>(representada))); if (representadaRetorno.EhValido()) { Commit(); } return(representadaRetorno); }
public ActionResult Atualizar(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RepresentadaViewModel representada = _representadaAppService.ObterPorId((Guid)id); if (representada == null) { return(HttpNotFound()); } return(View(representada)); }
public ActionResult Atualizar(RepresentadaViewModel representadaViewModel) { try { if (ModelState.IsValid) { var representadaRetorno = _representadaAppService.Atualizar(representadaViewModel); if (representadaRetorno.ValidationResult.IsValid) { TempData["AtualizadoSucesso"] = "Representada " + representadaRetorno.RazaoSocial + " atualizada com sucesso"; return(RedirectToAction("Index", "Representada")); } representadaViewModel.ValidationResult = representadaRetorno.ValidationResult; } return(View("Atualizar", representadaViewModel)); } catch (Exception e) { throw; } }