public ActionResult Cadastrar(DocumentosPessoal oDocumento) { if (ModelState.IsValid) { try { DocumentosPessoalBusiness.Inserir(oDocumento); TempData["MensagemSucesso"] = "O Documento '" + oDocumento.NomeDocumento + "' foi cadastrado com sucesso."; return Json(new { resultado = new RetornoJSON() { URL = Url.Action("Index", "DocumentosPessoal") } }); } catch (Exception ex) { if (ex.GetBaseException() == null) { return Json(new { resultado = new RetornoJSON() { Erro = ex.Message } }); } else { return Json(new { resultado = new RetornoJSON() { Erro = ex.GetBaseException().Message } }); } } } else { return Json(new { resultado = TratarRetornoValidacaoToJSON() }); } }
public ActionResult Cadastrar(DocumentosPessoal oDocumento) { if (ModelState.IsValid) { try { oDocumento.UsuarioInclusao = CustomAuthorizationProvider.UsuarioAutenticado.Login; DocumentosPessoalBusiness.Inserir(oDocumento); Extensions.GravaCookie("MensagemSucesso", "O documento '" + oDocumento.NomeDocumento + "' foi salvo com sucesso.", 10); return(Json(new { resultado = new RetornoJSON() { URL = Url.Action("Index", "DocumentosPessoal") } })); } catch (Exception ex) { if (ex.GetBaseException() == null) { return(Json(new { resultado = new RetornoJSON() { Erro = ex.Message } })); } else { return(Json(new { resultado = new RetornoJSON() { Erro = ex.GetBaseException().Message } })); } } } else { return(Json(new { resultado = TratarRetornoValidacaoToJSON() })); } }