Beispiel #1
0
        public HttpResponseMessage GetByStateAbbr(string stateAbbr)
        {
            var city = _cityServices.GetAllCityByStates(stateAbbr);

            if (city != null)
            {
                var cityEntities = city as List <CityEntity> ?? city.ToList();
                if (cityEntities.Any())
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, cityEntities));
                }
            }
            throw new ApiDataException(1000, "city not found", HttpStatusCode.NotFound);
        }