public ActionResult Create(SistemaViewModel sistemaViewModel) { if (ModelState.IsValid) { _sistemaAppService.Adicionar(sistemaViewModel); return(RedirectToAction("Index")); } return(View(sistemaViewModel)); }
public JsonResult CadastrarSistemaAlvo(SistemaAlvoViewModel sistemaAlvoViewModel) { try { _sistemaAppService.Adicionar(sistemaAlvoViewModel, DadosUsuario().CodUsuario); return(RetornoSucesso("Sistema cadastrado com sucesso!")); } catch (BusinessException ex) { log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Error(ex); return(RetornoMensagemErro(ex.Message)); } catch (Exception ex) { log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Error(ex); return(Json(new { Status = HttpStatusCode.InternalServerError, Codigo = 0, Mensagem = ex.Message }, JsonRequestBehavior.AllowGet)); } }