public ActionResult editar(int?id) { var ViewModel = new RevistaForm(); ViewModel.Revista = this.ONoticiaBL.carregar(UtilNumber.toInt32(id)) ?? new Noticia(); return(View(ViewModel)); }
public ActionResult editar(RevistaForm ViewModel) { if (!ModelState.IsValid) { return(View(ViewModel)); } ViewModel.Revista.idTipoNoticia = TipoNoticiaConst.REVISTA; bool flagSucesso = this.ONoticiaBL.salvar(ViewModel.Revista, ViewModel.Foto, ViewModel.Documento); if (flagSucesso) { this.Flash(UtilMessage.TYPE_MESSAGE_SUCCESS, "Os dados foram salvos com sucesso."); return(RedirectToAction("editar", new { id = ViewModel.Revista.id })); } this.Flash(UtilMessage.TYPE_MESSAGE_ERROR, UtilMessage.error("Erro!", "Houve um problema ao salvar o registro. Tente novamente.")); return(View(ViewModel)); }