Пример #1
0
        public async Task <IActionResult> OnGetAsync(Districts district)
        {
            if (!Enum.IsDefined(typeof(Districts), district))
            {
                return(RedirectToPage("./NotFound"));
            }

            LocationDisplayName = district.GetDisplayName();
            var results = await _ipma.GetForecastForLocation(district);

            Forecasts = results.ToList();

            foreach (var forecast in Forecasts)
            {
                forecast.Weather = _ipma.GetWeatherDetailsForForecast(forecast);
                forecast.Wind    = _ipma.GetWindDetailsForForecast(forecast);
                forecast.Icon    = WeatherIcon.GetIconForWeather(forecast.WeatherTypeId);
            }

            CurrentForecast = Forecasts.First();
            Forecasts       = Forecasts.Where(f => f != CurrentForecast);

            return(Page());
        }