private async void LoadCityList() { var CitiesModel = new CitiesModel(CityText, this); CitiesResponseModel cities = await SL.Manager.GetCityList(); if (cities.result == null) { CitiesModel.Items = new List <string> { "Philadelphia", "New York City", "Chicago", "Washington D.C.", "London", "Jakarta", "Ibiza", "Las Vegas", "Amsterdam", "Miami", "Istanbul", "Rio de Janeiro", "Austin", "Bucharest", "Tallahassee", "Ft. Lauderdale", "Atlanta", "Sheffield", "Leeds", "Birmingham", "Manchester", "Antwerp", "Cochabamba", "Buenos Aires", "La Paz", "Santa Cruz", "Los Angeles", "Johannesburg", "Sydney", "Brighton", "Reading", "Charleston", "Buffalo", "Portland", "Raleigh" }; } if (cities.result != null) { CitiesModel.Items = cities.result; CitiesModel.Items.Sort(); } ListOfCities = CitiesModel.Items; var PickerView = new UIPickerView { DataSource = CitiesModel, Delegate = CitiesModel }; CityText.InputView = PickerView; }
public ActionResult <CitiesResponseModel> GetAllCities() { var allCities = new CitiesResponseModel { Cities = _context.Cities.Select(cityInfo => new CityInfoResponseModel { CityId = cityInfo.Id, CityName = cityInfo.Name, Country = cityInfo.Country, FromDate = cityInfo.Forecasts.Min(i => i.ForecastTime), ToDate = cityInfo.Forecasts.Max(i => i.ForecastTime) }).ToList() }; return(Ok(allCities)); }