Пример #1
0
        public async Task <List <string> > GetCitiesByCountry(string code)
        {
            var cities = new List <string>();

            //Load cities depending selected country otherwise empty list
            if (!string.IsNullOrEmpty(code))
            {
                var citiesList = await Context_.GetAllCitiesByCountryCodeAsync(code);

                JObject jsonCities = JObject.Parse(Encoding.UTF8.GetString(citiesList));

                var results_ = jsonCities["results"];

                cities = results_.ToObject <List <City> >().Select(x => x.city).ToList();
            }

            return(cities);
        }