Exemple #1
0
        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);
        }