public ActionResult ObterUsuario(FiltroViewModel usuarioModel) { JsonResultCustom jsonResult = new JsonResultCustom(); if (!ModelState.IsValid) { jsonResult.Messages = GetErrorsModelState(); return(Json(jsonResult)); } var usuario = _usuarioIdentityRepository.ObterUsuarioPorMatricula(usuarioModel.MatriculaUsuario); if (usuario != null) { jsonResult.Data = usuario; jsonResult.Success = true; jsonResult.Messages.Add("Usuário localizado com sucesso."); } else { jsonResult.Success = false; jsonResult.Messages.Add("o usuário informado não foi localizado."); } return(Json(jsonResult)); }
public ActionResult AtualizarAcesso(string matricula, int perfilId, bool ativo) { JsonResultCustom jsonResult = new JsonResultCustom(); var alterado = _usuarioIdentityRepository.AtualizarPerfil(matricula.ToUpper(), perfilId, ativo); if (alterado) { jsonResult.Success = true; jsonResult.Messages.Add("Alteração realizada com sucesso."); } return(Json(jsonResult)); }
public ActionResult SalvaProrrogacao([Bind(Include = "T005_ID_PRORROGA_INFORME,T002_ID_INFORME,T004_NR_SEMANA,T004_COMPETENCIA")] T005_PRORROGA_INFORME t005_PRORROGA_INFORME) { JsonResultCustom jsonResult = new JsonResultCustom(); if (ModelState.IsValid) { //if (t002_INFORME.T002_ID_INFORME > 0) //{ // _informe.Atualizar(t002_INFORME); // _informe.SaveChanges(); // jsonResult.Success = true; // jsonResult.Messages.Add("Alteração realizada com sucesso."); //} } return(Json(jsonResult)); }
public ActionResult Create(ExemploEntity model) { var jsonResult = new JsonResultCustom(); if (!ModelState.IsValid) { jsonResult.Messages = GetErrorsModelState(); return(Json(jsonResult)); } _exemploRepository.Adicionar(model); if (_exemploRepository.SaveChanges()) { jsonResult.Success = true; jsonResult.Messages.Add("Operação realizada com sucesso."); return(Json(jsonResult)); } jsonResult.Messages = GetErrorsModelState(); return(Json(jsonResult)); }
public ActionResult Edit(ExemploEntity model) { var jsonResult = new JsonResultCustom(); if (!ModelState.IsValid) { jsonResult.Messages = GetErrorsModelState(); return(Json(jsonResult)); } _exemploRepository.Atualizar(model); if (_exemploRepository.SaveChanges()) { jsonResult.Success = true; jsonResult.Url = Url.Action("DetailsLineTable", new { id = model.EXEMPLO_ID }); jsonResult.Messages.Add("Operação realizada com sucesso."); return(Json(jsonResult)); } jsonResult.Messages = GetErrorsModelState(); return(Json(jsonResult)); }
public ActionResult Create([Bind(Include = "T002_ID_INFORME,T002_INFORME_TITULO,T002_RESULTADO_ESPERADO,T001_ID_INDICE_INFORME,T003_ID_COORDENACAO,T004_NR_SEMANA,T002_IN_REUSADO,T002_MAT_CRIADO_POR,T002_DT_ATUALIZACAO,T002_COMPETENCIA")] T002_INFORME t002_INFORME) { JsonResultCustom jsonResult = new JsonResultCustom(); t002_INFORME.T002_DT_ATUALIZACAO = DateTime.Now; if (ModelState.IsValid) { if (t002_INFORME.T002_ID_INFORME > 0) { _informe.Atualizar(t002_INFORME); _informe.SaveChanges(); jsonResult.Success = true; jsonResult.Messages.Add("Alteração realizada com sucesso."); } else { _informe.Adicionar(t002_INFORME); _informe.SaveChanges(); jsonResult.Success = true; jsonResult.Messages.Add("Informação registada com sucesso."); } } return(Json(jsonResult)); }