public ActionResult TerminarComRedirect(string IdCat) { try { CAT oCat = CatBusiness.Consulta.FirstOrDefault(p => p.UniqueKey.Equals(IdCat)); if (oCat == null) { return(Json(new { resultado = new RetornoJSON() { Erro = "Não foi possível excluir esta codificação, pois a mesma não foi localizada." } })); } else { oCat.DataExclusao = DateTime.Now; oCat.UsuarioExclusao = "LoginTeste"; CatBusiness.Alterar(oCat); TempData["MensagemSucessoTerminar"] = "A codificação foi foi excluída com sucesso."; return(Json(new { resultado = new RetornoJSON() { URL = Url.Action("Index", "EmpProprio") } })); } } 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 } })); } } }
public ActionResult Terminar(string IdCat) { try { CAT oCat = CatBusiness.Consulta.FirstOrDefault(p => p.UniqueKey.Equals(IdCat)); if (oCat == null) { return(Json(new { resultado = new RetornoJSON() { Erro = "Não foi possível excluir a CAT, pois a mesma não foi localizado." } })); } else { oCat.DataExclusao = DateTime.Now; oCat.UsuarioExclusao = "LoginTeste"; CatBusiness.Alterar(oCat); return(Json(new { resultado = new RetornoJSON() { Sucesso = "Esta Cat foi excluído com sucesso." } })); } } 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 } })); } } }
public ActionResult Atualizar(CAT TCat) { if (ModelState.IsValid) { try { CatBusiness.Alterar(TCat); TempData["MensagemSucessoCatAtulizado"] = "A CAT foi atualizado com sucesso."; return(Json(new { resultado = new RetornoJSON() { URL = Url.Action("Index", "Registro") } })); } 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() })); } }