public async Task<List<CityForecast>> GetCityForecastsAsync(List<City> cities) { var cityWeatherForecastSource = new CityWeatherForecastSource(_webTools); var cityForecasts = new List<CityForecast>(); foreach (var city in cities) { cityForecasts.Add(await GetCityForecast(cityWeatherForecastSource, city)); } return cityForecasts; }
private static async Task<CityForecast> GetCityForecast(CityWeatherForecastSource cityWeatherForecastSource, City city) { var forecastJson = await cityWeatherForecastSource.GetJsonAsync(city); var response = JsonConvert.DeserializeObject<WUGResponse>(forecastJson); return Transformers.GetCityForecast(city, response); }