Пример #1
0
        public override IEnumerable<Weather> RefreshWeather(Location location)
        {
            var weather = _repository.FindWeather(location.LocationID);
            if (!weather.Any() || weather.Any(x => x.NextUpdate < DateTime.Now))
            {
                foreach (var item in weather)
                {
                    _repository.DeleteWeather(item.WeatherID);
                }

                weather = _owmWebservice.GetForecast(location);

                foreach (var item in weather)
                {
                    _repository.AddWeather(item);
                }

                _repository.Save();
            }

            return weather;
        }
Пример #2
0
 public abstract IEnumerable<Weather> RefreshWeather(Location location);