public async Task <IActionResult> GetWeather(string city = null, string id = null, string zip = null, string language = null, string units = null)
        {
            if (Int32.TryParse(city, out int ID))
            {
                city = null;  id = ID.ToString();
            }
            OpenWeatherService weatherService = new OpenWeatherService();
            ResultRequest      result         = await weatherService.GetWeatherAsync(city, id, zip, language, units);

            ViewBag.Error = result.RequestStatus;
            return(View(result.Weather));
        }
示例#2
0
 public async Task <IViewComponentResult> InvokeAsync(string region)
 {
     return(View("", await _weather.GetWeatherAsync()));
 }