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 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)); }