public WeatherViewModel WeatherInfo(AddressViewModel addressViewModel, bool extendHourly) { WeatherViewModel weatherViewModel = null; ForecastIOResponse currentWeather = GetWeatherInfo(addressViewModel.Address, extendHourly); if (currentWeather != null) { // Get address info Address addressInfo = GetGeoInfo(addressViewModel.Address); // Get weather info for previous week List<ForecastIOResponse> previousWeekWeather = new List<ForecastIOResponse>(); for (int i = 7; i > 0; i--) { ForecastIOResponse previousWeather = GetWeatherInfo(addressViewModel.Address, DateTime.Now.AddDays(-i)); previousWeekWeather.Add(previousWeather); } // Setup return view model weatherViewModel = new WeatherViewModel() { CurrentWeather = currentWeather, PreviousWeekWeather = previousWeekWeather, AddressInfo = addressInfo }; } return weatherViewModel; }
public ActionResult _PreviousWeatherChart(WeatherViewModel weatherViewModel) { Highcharts chart = _weatherInfoService.WeatherChart(weatherViewModel.PreviousWeekWeather); return PartialView(chart); }