public async Task <Forecast> GetForecastAsync(string city, WeatherUnit unit = WeatherUnit.Metric) { if (_ratelimiter.IsRatelimited(nameof(WeatherApiService))) { return(null); } try { return(await _api.GetForecastAsync(city, unit.ToString().ToLower(), _apiKey)); } catch (Exception ex) { _logger.LogError(ex.ToString()); } return(null); }
public async Task <WeatherForecast> Query([FromQuery(Name = "city")] string city) { return(await _weatherApi.GetForecastAsync(city)); }