Esempio n. 1
0
        // GET: Parks/Details/{id}
        public async Task <IActionResult> Details(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            else
            {
                var park = await _context.Parks.FirstOrDefaultAsync(m => m.ParkCode == id);

                if (park == null)
                {
                    return(NotFound());
                }
                else
                {
                    // Forecast - "daily" data block with 8 data points for 8 days of weather
                    Forecast forecast = await darkSky.GetForecast(park);

                    // Creates Weather objects for each day
                    park.DaysOfWeather = darkSky.GetWeatherForWeek(park, forecast);
                    return(View(park));
                }
            }
        }