Example #1
0
        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));
        }
Example #2
0
        public void GeoBO_ListaCidade()
        {
            //teste do método ListarCidade(string uf)
            var geo = geoBO.ListarCidade("RS");

            Assert.AreNotEqual(0, geo.Count);
            if (geo.Count > 0)
            {
                Assert.AreEqual(false, string.IsNullOrEmpty(geo[0].Nome));
            }
        }