コード例 #1
0
        // GET: /<controller>/
        public async Task <IActionResult> Index(string searchString)
        {
            if (String.IsNullOrEmpty(searchString))
            {
                return(RedirectToAction("Index", "Home"));
            }

            ForecastsView forecastsView = new ForecastsView();

            Location location = await _locationService.GetLocation(searchString, _apiSettings);

            forecastsView.Location       = location;
            forecastsView.DailyForecasts = await _forecastService.GetDailyForecasts(location.LocationKey, _apiSettings);

            forecastsView.HourlyForecasts = await _forecastService.GetHourlyForecasts(location.LocationKey, _apiSettings);

            return(View(forecastsView));
        }