コード例 #1
0
        public ActionResult Get(string countryCode)
        {
            if (countryCode.Length != 2)
            {
                return(BadRequest(new { error = "Bad input!" }));
            }

            var cityList = _citiesRepository.GetCitiesByCountry(countryCode);

            if (cityList == null || cityList.ToList().Count == 0)
            {
                return(NotFound());
            }

            return(Ok(cityList));
        }