public ActionResult editar(PlanoAnuncioForm ViewModel) { if (!ModelState.IsValid) { this.Flash(UtilMessage.TYPE_MESSAGE_ERROR, "Houve um problema ao salvar o registro. Tente novamente."); return(View(ViewModel)); } bool flagSucesso = this.OAnuncioBL.salvar(ViewModel.Anuncio, ViewModel.OArquivo); 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.")); } if (flagSucesso) { return(RedirectToAction("editar", new { id = ViewModel.Anuncio.idPlanoContratacao })); } return(View(ViewModel)); }
public ActionResult editar(int?id) { var ViewModel = new PlanoAnuncioForm(); ViewModel.Anuncio = this.OAnuncioBL.carregarPorContratacao(id.toInt()) ?? new Anuncio(); ViewModel.Anuncio.idPlanoContratacao = id.toInt(); return(View(ViewModel)); }