public ActionResult editar(int?id) { OcorrenciaRelacionamentoForm ViewModel = new OcorrenciaRelacionamentoForm(); ViewModel.OcorrenciaRelacionamento = this.OOcorrenciaRelacionamentoPadraoBL.carregar(UtilNumber.toInt32(id)) ?? new OcorrenciaRelacionamentoPadrao(); return(View(ViewModel)); }
public ActionResult editar(OcorrenciaRelacionamentoForm ViewModel) { if (!ModelState.IsValid) { return(View(ViewModel)); } bool flagSucesso = this.OOcorrenciaRelacionamentoPadraoBL.salvar(ViewModel.OcorrenciaRelacionamento); if (flagSucesso) { this.Flash(UtilMessage.TYPE_MESSAGE_SUCCESS, UtilMessage.success("Sucesso", "Os dados foram salvos com sucesso.")); } else { this.Flash(UtilMessage.TYPE_MESSAGE_ERROR, UtilMessage.error("Falha", "Não foi possível salvar as informações, tente novamente.")); } return(RedirectToAction("editar", new { id = ViewModel.OcorrenciaRelacionamento.id })); }