public RetornoModel <List <string> > Get(bool apenasEventos = true) { var retorno = new RetornoModel <List <string> >(); List <string> cidades; try { using (var ado = new MasterADOBase()) { var geobo = new GeoBO(ado); cidades = apenasEventos ? geobo.ListarEstadoLocal() : geobo.ListarEstado().Select(t => t.Sigla).ToList(); } } catch (Exception e) { retorno.Sucesso = false; retorno.Mensagem = e.Message; LogUtil.Error(e); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } retorno.Sucesso = true; retorno.Retorno = cidades; if (cidades.Count == 0) { retorno.Mensagem = "Nenhum estado encontrado"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; } return(ParseRetorno(retorno)); }
public async Task <RetornoModel> GetArea() { RetornoModel resultado = new RetornoModel(); resultado.Object = _context.Area.ToList(); return(await Task.Run(() => resultado)); }
public RetornoModel <List <string> > GetCidades(string uf, bool apenasEventos = true) { var retorno = new RetornoModel <List <string> >(); List <string> cidades = null; try { using (var ado = new MasterADOBase()) { var geobo = new GeoBO(ado); cidades = apenasEventos ? geobo.ListarCidadeLocal(uf) : geobo.ListarCidade(uf).Select(c => c.Nome).ToList(); } } catch (Exception e) { retorno.Mensagem = e.Message; LogUtil.Error(e); } retorno.Sucesso = true; retorno.Retorno = cidades; if (cidades == null || cidades.Count == 0) { retorno.Sucesso = false; retorno.Mensagem = "Nenhuma cidade encontrada"; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; } return(ParseRetorno(retorno)); }
public RetornoModel<List<ClienteComprasCotaNetModel>> GetClienteComprasCota(string cpf) { RetornoModel<List<ClienteComprasCotaNetModel>> retorno = new RetornoModel<List<ClienteComprasCotaNetModel>>(); List<ClienteComprasCotaNetModel> resultado = null; try { using (var ado = new MasterADOBase()) { ClienteBO clienteBO = new ClienteBO(ado); resultado = clienteBO.ListaComprasCotaNet(cpf); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Retorno = resultado; retorno.Sucesso = true; if (resultado == null || resultado.Count == 0) { retorno.Sucesso = false; retorno.Mensagem = "Nenhuma compra com cota de 50% encontrada para o cpf"; throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; } return ParseRetorno(retorno); }
public async Task <RetornoModel> editar(Guid id) { RetornoModel resultado = new RetornoModel(); resultado.Object = _context.Contato.Where(x => x.id == id).FirstOrDefault(); return(await Task.Run(() => resultado)); }
public RetornoModel <List <Local> > Get(string busca = null, string uf = null, string cidade = null) { var retorno = new RetornoModel <List <Local> >(); List <Local> lstLocal; try { using (var ado = new MasterADOBase()) { var localBO = new LocalBO(ado); lstLocal = localBO.Listar(busca, uf, cidade); } } catch (Exception ex) { retorno.Sucesso = false; retorno.Mensagem = ex.Message; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } if (lstLocal.Count > 0) { retorno.Sucesso = true; retorno.Mensagem = "OK"; retorno.Retorno = lstLocal; } else { retorno.Mensagem = "Nenhum local encontrado"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } return(ParseRetorno(retorno)); }
public async Task AtualizaRetornoIoPeople(RetornoModel r) { using (var conn = new SqlConnection(Util.ConnString)) { await conn.OpenAsync(); try { var p = new DynamicParameters(); p.Add("Codigo", r.Codigo, DbType.Int32, ParameterDirection.Input); p.Add("Comentario", r.ComentarioAdicional, DbType.String, ParameterDirection.Input); p.Add("ScoreClassificacao", r.Score, DbType.Decimal, ParameterDirection.Input); p.Add("ClassificacaoID", r.Classificacao, DbType.Int32, ParameterDirection.Input); await conn.ExecuteAsync("UPDATE CAMPANHA_RETORNO SET SCORECLASSIFICACAO=@ScoreClassificacao, COMENTARIO=@Comentario, CLASSIFICACAOID=@ClassificacaoID WHERE CODIGO=@Codigo", p, commandTimeout : 888); } catch (Exception err) { throw err; } finally { conn.Close(); } } }
public RetornoModel Remover(int id) { RetornoModel result = new RetornoModel { Mensagem = "Registro não encontrado" }; try { var user = _ado.Carregar(id); if (user != null) { user.Ativo = false; _ado.Atualizar(user); result.Sucesso = true; result.Mensagem = "Registro removido com sucesso!"; } } catch (Exception ex) { LogUtil.Error(ex); result.Mensagem = "Não foi possível realizar a atualização do registro."; } return(result); }
public async Task <RetornoModel> PostEmpresaModel([FromBody] EmpresaModel empresaModel) { RetornoModel resultado = new RetornoModel(); empresaModel.Id = Guid.NewGuid(); if (empresaModel.Nome == string.Empty) { resultado.Message = "Nome obrigatorio!"; } try { _context.Empresa.Add(empresaModel); await _context.SaveChangesAsync(); resultado.Success = true; resultado.Message = "Operação realizada com sucesso!"; } catch (Exception ex) { resultado.Success = false; resultado.Message = "Erro ocorrendo!"; throw ex; } return(resultado); }
protected RetornoModel <T, TEnum> ParseRetorno <T, TEnum>(RetornoModel <T, TEnum> retorno) { try { if (HttpContext.Current.Request.QueryString["removeRetorno"] != null) { try { retorno.SetPropByName("Retorno", null); } catch { } } else { retorno.Retorno = ParseRetorno(retorno.Retorno); } return(retorno); } catch (Exception ex) { LogUtil.Error(string.Format("##Master.ParseRetorno<T, TEnum>.EXCEPTION## SESSION {0}, MSG {1}", (this.SessionModel != null) ? this.SessionModel.SessionID : "NA", ex.Message), ex); retorno.Mensagem = ex.Message; return(retorno); } }
public virtual ActionResult Index(UsuarioViewModel usuario, string returnUrl = null) { UsuarioService service = new UsuarioService(); if (string.IsNullOrEmpty(usuario.login) || string.IsNullOrEmpty(usuario.senha)) { ModelState.AddModelError("", "É obrigatório o preenchimento de Login e Senha"); } else { RetornoModel <Usuario, enumUsuarioException> retorno = service.Logar(usuario.login, usuario.senha); if (retorno.Sucesso) { SessionModel.Usuario = retorno.Retorno; SalvarSessao(); var AuthenticationManager = HttpContext.GetOwinContext().Authentication; AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = true }, service.CriarIdentity(SessionModel.Usuario)); return(Redirect(returnUrl)); } else { ModelState.AddModelError("", retorno.Mensagem); } } ViewBag.ReturnUrl = returnUrl; return(View(usuario)); }
public RetornoModel <CategoriaModel> Salvar(CategoriaModel model) { RetornoModel <CategoriaModel> result = new RetornoModel <CategoriaModel> { Mensagem = "OK" }; try { if (model.ID > 0) { result.Sucesso = _ado.Atualizar(model.MapTo <Categoria>()); result.Retorno = model; if (!result.Sucesso) { result.Mensagem = "Registro não localizado para modificação. Verifique se o ID informado está correto"; } } else { result.Retorno = _ado.Inserir(model.MapTo <Categoria>()).MapTo <CategoriaModel>(); result.Sucesso = true; } } catch (Exception ex) { LogUtil.Error(ex); throw; } return(result); }
protected void CarregarCliente(ClienteBO clienteBO, bool carregarEnderecos = false) { LogUtil.Debug(string.Format("##CarregarCliente## SESSION {0}", (this.SessionModel != null) ? this.SessionModel.SessionID : "NA")); try { if ((SessionModel.ClienteID > 0) && (SessionModel.Login == null)) { SessionModel.Login = clienteBO.Consultar(SessionModel.ClienteID, false); } if ((SessionModel.Login != null) && (SessionModel.Login.Cliente.EnderecoList == null)) { SessionModel.Login.Cliente = clienteBO.CarregarEnderecos(SessionModel.Login.Cliente); } } catch (Exception ex) { LogUtil.Error(string.Format("##CarregarCliente.EXCEPTION## SESSION {0}, MSG {1}", (this.SessionModel != null) ? this.SessionModel.SessionID : "NA", ex.Message), ex); var retorno = new RetornoModel <CompraModel>(); retorno.Mensagem = ex.Message; retorno.Sucesso = false; //LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } }
public RetornoModel Remover(int id, int idUsuario) { RetornoModel result = new RetornoModel { Mensagem = "Registro não encontrado" }; try { var registro = _ado.Carregar(id); if (registro != null) { registro.Ativo = false; _ado.Atualizar(registro); InserirHistorico(id, AcaoProposta.Exclusao, idUsuario); result.Sucesso = true; result.Mensagem = "Registro removido com sucesso!"; } } catch (Exception ex) { LogUtil.Error(ex); result.Mensagem = "Não foi possível realizar a atualização do registro."; } return(result); }
private RetornoModel <PropostaModel> Salvar(PropostaModel model) { RetornoModel <PropostaModel> result = new RetornoModel <PropostaModel> { Mensagem = "OK" }; try { model.Data = new DateTime(model.Data.Year, model.Data.Month, model.Data.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0); if (model.ID > 0) { result.Sucesso = _ado.Atualizar(model.MapTo <Proposta>()); result.Retorno = model; if (!result.Sucesso) { result.Mensagem = "Registro não localizado para modificação"; } } else { result.Retorno = _ado.Inserir(model.MapTo <Proposta>()).MapTo <PropostaModel>(); InserirHistorico(result.Retorno.ID, AcaoProposta.Criacao, model.IdUsuario); result.Sucesso = true; } } catch (Exception ex) { LogUtil.Error(ex); throw; } return(result); }
public void SolicitaReservaMesaFechada() { try { CarrinhoBO CarrinhoBO = new CarrinhoBO(); CompraModel compra = new CompraModel(); compra.SessionID = "1sadasdlasdjkahskjdAA"; //Logado Maicon ClienteBO ClienteBO = new ClienteBO(1); //compra.Login = ClienteBO.ConsultarCPF("01259436012"); RetornoModel <CompraModel> result = CarrinhoBO.SolicitarReservaMesaFechada(compra, 163464, 2199235, 1637525); Console.WriteLine(result.Mensagem); Console.WriteLine(result.Retorno); Console.WriteLine(result.Sucesso); Assert.AreNotEqual(null, result); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public RetornoModel loginUsuario(string usuario) { RetornoModel retorno = new RetornoModel(); try{ var _usuario = _local.usuario.Where(d => d.nome == usuario && d.ativo == true).FirstOrDefault(); if (_usuario != null) { retorno.status = "Erro"; retorno.resultado = "Usuário já existe"; return(retorno); } else { UsuarioModel novousuario = new UsuarioModel(); novousuario.ativo = true; novousuario.datacriacao = DateTime.Now; novousuario.nome = usuario; _local.usuario.Add(novousuario); _local.SaveChanges(); var token = gerarToken(usuario); retorno.status = "OK"; retorno.resultado = token; return(retorno); } }catch (Exception e) { return(retorno); } }
public RetornoModel EntrarSala(string nomesala, string usuario) { RetornoModel retorno = new RetornoModel(); try{ var sala = _local.sala.Where(d => d.nomesala == nomesala).FirstOrDefault(); if (sala != null) { if (sala.jogador2 == null) { retorno.status = "OK"; retorno.resultado = "Entrou na sala"; return(retorno); } else { retorno.status = "Erro"; retorno.resultado = "Sala Cheia"; return(retorno); } } else { retorno.status = "Erro"; retorno.resultado = "Sala Não existe"; return(retorno); } }catch (Exception e) { return(retorno); } }
public RetornoModel <List <Evento> > GetDestaques(string tipo, int regiao = 1) { var retorno = new RetornoModel <List <Evento> >(); List <Evento> eventos; try { using (var eventoBO = new EventoBO()) { eventos = eventoBO.ListarDestaques(tipo, regiao, SessionModel.CanalID); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } retorno.Retorno = eventos; retorno.Sucesso = true; if (eventos == null || eventos.Count == 0) { retorno.Mensagem = "Destaques não encontrados"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Mensagem = "OK"; return(ParseRetorno(retorno)); }
public RetornoModel <tValeIngresso> GetValeIngresso(string codigo) { RetornoModel <tValeIngresso> retorno = new RetornoModel <tValeIngresso>(); tValeIngresso valeIngresso = null; try { using (var ado = new MasterADOBase()) { ValeIngressoBO valeIngressoBO = new ValeIngressoBO(ado); valeIngresso = valeIngressoBO.ValidarCodigo(codigo); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } retorno.Retorno = valeIngresso; if (valeIngresso != null) { retorno.Mensagem = "OK"; retorno.Sucesso = true; } else { retorno.Mensagem = "Código do vale ingresso inválido"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse((HttpStatusCode)422, ParseRetorno(retorno))); } return(ParseRetorno(retorno)); }
public RetornoModel <List <FormaPagamento> > GetFormasPagamento(int eventoID) { RetornoModel <List <FormaPagamento> > retorno = new RetornoModel <List <FormaPagamento> >(); try { using (var ado = new MasterADOBase()) { FormaPagamentoBO fpbo = new FormaPagamentoBO(ado); List <FormaPagamento> resultado = fpbo.ListarEvento(eventoID); retorno.Retorno = resultado; if (resultado == null || resultado.Count == 0) { retorno.Sucesso = false; retorno.Mensagem = "Nenhuma forma de pagamento disponivel para esse evento"; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Sucesso = true; retorno.Mensagem = "OK"; return(ParseRetorno(retorno)); } } } catch (Exception ex) { retorno.Retorno = null; retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } }
public RetornoModel <List <Setor> > GetSetores(int eventoID, int apresentacaoID, [FromUri] bool comCotaNominal = true, [FromUri] bool comCotaPromocional = true) { RetornoModel <List <Setor> > retorno = new RetornoModel <List <Setor> >(); List <Setor> resultado = null; try { using (var setorBO = new SetorBO()) { resultado = setorBO.ListarOSESP(apresentacaoID, comCotaNominal, comCotaPromocional); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Retorno = resultado; retorno.Sucesso = true; if (resultado == null || resultado.Count == 0) { retorno.Sucesso = false; retorno.Mensagem = "Nenhum setor encontrado par a apresentação ou apresentação não encontrada"; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; } return(ParseRetorno(retorno)); }
protected RetornoModel LimparCompra(CarrinhoBO carrinhoBO) { SessionModel.EntregaControleID = 0; SessionModel.PDVID = 0; SessionModel.ClienteEnderecoID = 0; SessionModel.ValesIngressoID = null; RetornoModel retorno = new RetornoModel(); retorno.Mensagem = "Ok"; retorno.Sucesso = true; try { var carrinhoItens = carrinhoBO.Listar(SessionModel.SessionID, SessionModel.ClienteID, enumCarrinhoStatus.reservado); carrinhoBO.LimparReserva(SessionModel.SessionID, enumIngressoStatus.disponivel, carrinhoItens); } catch (Exception ex) { LogUtil.Error(string.Format("##Master.LimparCompra.EXCEPTION## SESSION {0}, MSG {1}", (this.SessionModel != null) ? this.SessionModel.SessionID : "NA", ex.Message), ex); retorno.Mensagem = ex.Message; retorno.Sucesso = false; //LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } return(retorno); }
public RetornoModel <List <PontoVenda> > GetPontosVenda(string uf, string cidade) { var retorno = new RetornoModel <List <PontoVenda> >(); List <PontoVenda> lstPontoVenda; try { using (var ado = new MasterADOBase()) { var pontoVendaBO = new PontoVendaBO(ado); lstPontoVenda = pontoVendaBO.ListarPdvPermiteRetirada(cidade, uf); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } retorno.Retorno = lstPontoVenda; retorno.Sucesso = true; if (lstPontoVenda.Count == 0) { retorno.Mensagem = "Nenhum ponto de venda encontrado"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; } return(ParseRetorno(retorno)); }
public RetornoModel <List <EventoSubtipo> > Get(int tipoId, bool apenasEventos = false) { RetornoModel <List <EventoSubtipo> > retorno = new RetornoModel <List <EventoSubtipo> >(); List <EventoSubtipo> lstSubTipo = null; try { using (var ado = new MasterADOBase()) { var subTipoBO = new SubtipoBO(ado); lstSubTipo = subTipoBO.ListarTipo(tipoId, apenasEventos); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } retorno.Retorno = lstSubTipo; retorno.Sucesso = true; if (lstSubTipo.Count == 0) { retorno.Mensagem = "Nenhum Subtipo encontrado para o tipo informado"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; } return(ParseRetorno(retorno)); }
public RetornoModel <Login, enumClienteException> GetLogado() { RetornoModel <Login, enumClienteException> retorno; using (var ado = new MasterADOBase()) { ClienteBO clienteBO = new ClienteBO(SessionModel.GetSiteId()); CarregarClienteOSESP(clienteBO, false); if (SessionModel.Login == null) { retorno = new RetornoModel <Login, enumClienteException>() { Sucesso = false, Mensagem = "Não existe um cliente logado", Retorno = null, Tipo = enumClienteException.usuarioNaoEncontrado }; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse((HttpStatusCode)422, ParseRetorno(retorno))); } else { Login login = SessionModel.Login; retorno = new RetornoModel <Login, enumClienteException>(); retorno.Sucesso = true; retorno.Retorno = login; } } return(ParseRetorno(retorno)); }
public RetornoModel <UsuarioModel> Login(string cpf, string senha) { RetornoModel <UsuarioModel> result = new RetornoModel <UsuarioModel> { Mensagem = "Usuário ou senha incorretos." }; try { var user = _ado.CarregarPorCPF(cpf); if (user != null) { if (CriptografiaUtil.VerificarSenha(user.Senha, senha)) { result.Retorno = user.MapTo <UsuarioModel>(); result.Sucesso = true; result.Mensagem = "OK"; } } } catch (Exception ex) { LogUtil.Error(ex); throw; } return(result); }
public RetornoModel <Local> Get(int id) { var retorno = new RetornoModel <Local>(); Local local; try { using (var ado = new MasterADOBase()) { var localBO = new LocalBO(ado); local = localBO.Consultar(id); } } catch (Exception ex) { retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } if (local != null) { retorno.Sucesso = true; retorno.Mensagem = "OK"; retorno.Retorno = local; } else { retorno.Mensagem = "Nenhum Local encontrado"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } return(ParseRetorno(retorno)); }
public RetornoModel <RetornoOsespModel> PostBloquearIngresso([FromBody] OsespIngresso req) { RetornoModel <RetornoOsespModel> retorno = new RetornoModel <RetornoOsespModel>(); if (req.ingressoID == 0) { retorno.Mensagem = "Ingresso ID obrigatório"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest, ParseRetorno(retorno))); } int UsuarioOSESPID = Convert.ToInt32(ConfigurationManager.AppSettings["UsuarioOSESPID"]); int PluID = Convert.ToInt32(ConfigurationManager.AppSettings["OSESPID_PLU"]); int PluUtilizadoID = Convert.ToInt32(ConfigurationManager.AppSettings["OSESPID_PLU_UTILIZADO"]); int BloqueioPadrao = Convert.ToInt32(ConfigurationManager.AppSettings["BLOQUEIO_PADRAO"]); try { using (var ado = new MasterADOBase()) { EventoBO eventoBO = new EventoBO(ado); IngressoBO ingressoBO = new IngressoBO(ado); retorno.Sucesso = ingressoBO.BloquearIngressoOSESP(req.ingressoID, UsuarioOSESPID, PluID, PluUtilizadoID, BloqueioPadrao); if (retorno.Sucesso) { tIngresso ingresso = ingressoBO.BuscaRetornoOsesp(req.ingressoID); RetornoOsespModel rom = new RetornoOsespModel(); rom.BloqueioID = Convert.ToInt32(ingresso.BloqueioID); rom.Status = "Bloqueado"; rom.BloqueioNome = ingressoBO.BuscaNomeBloqueio(Convert.ToInt32(ingresso.BloqueioID)); retorno.Retorno = rom; } } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } if (!retorno.Sucesso) { retorno.Mensagem = "Ingresso não encontrado ou não disponível para bloqueio"; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse((HttpStatusCode)422, ParseRetorno(retorno))); } else { retorno.Mensagem = "OK"; return(ParseRetorno(retorno)); } }
/// <summary> /// /// </summary> /// <returns></returns> protected HttpResponseMessage ModelInvalidResponse() { var retorno = new RetornoModel { Mensagem = string.Join("; ", ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage)) }; return(Request.CreateResponse(HttpStatusCode.BadRequest, retorno)); }