Exemple #1
0
 public MyQuery(
     WeatherForecastRepository weatherForecastRepository,
     ILogger <MyQuery> logger)
 {
     _weatherForecastRepository = weatherForecastRepository;
     _logger = logger;
 }
Exemple #2
0
 public WeatherForecastController(IEventBus eventBus, WeatherForecastRepository weatherRepo,
                                  ILogger <WeatherForecastController> logger)
 {
     _eventBus    = eventBus;
     _weatherRepo = weatherRepo;
     _logger      = logger;
 }
        protected override async Task ExecuteJobAsync()
        {
            // ToDo: Bulk
            foreach (var forecasts in Grabber.Grabber.GetForecasts())
            {
                foreach (var forecast in forecasts)
                {
                    var exist = await WeatherForecastRepository.ExistsAsync(w => w.City.Name == forecast.CityName && w.Date.Date == forecast.Date.Date);

                    if (exist)
                    {
                        await WeatherForecastRepository.SaveAsync(forecast);
                    }
                    else
                    {
                        var city = (await CityRepository.FindAsync(c => c.Name == forecast.CityName)).FirstOrDefault();
                        SetWeatherCity(forecast, city);

                        await WeatherForecastRepository.CreateAsync(forecast);
                    }
                }
            }

            // ToDO: informative log
            Logger.LogInformation("GRABBED!");
        }
        public async Task <Models.WeatherForecast> GetResult(string userId, string remoteIpAddress, bool force)
        {
            var weatherForecastBuilder = new WeatherForecastBuilder();
            var result = await weatherForecastBuilder.GetWeatherForecastCache(remoteIpAddress, force);

            var weatherForecastRepository = new WeatherForecastRepository();
            var userEntry = new WeatherForecastData
            {
                UserId = userId,
                City   = result.City
            };

            await weatherForecastRepository.InsertUserHistory(userEntry);

            return(result);
        }
 public WeatherForecastGeneratedEventHandler(WeatherForecastRepository weatherRepo, ILogger <WeatherForecastGeneratedEventHandler> logger)
 {
     _weatherRepo = weatherRepo;
     _logger      = logger;
 }
Exemple #6
0
 public WeatherForecastController(WeatherForecastRepository weatherRepo, ILogger <WeatherForecastController> logger)
 {
     _weatherRepo = weatherRepo;
     _logger      = logger;
 }
 public WeatherForecastController(ILogger <WeatherForecastController> logger)
 {
     _logger = logger;
     _weatherForecastRepository = new WeatherForecastRepository();
 }
Exemple #8
0
 public WeatherForecastService(WeatherForecastRepository weatherForecastRepository)
 {
     _weatherForecastRepository = weatherForecastRepository;
 }
Exemple #9
0
 public DenyWeatherForecastController(WeatherForecastRepository repository, ILogger <DenyWeatherForecastController> logger)
 {
     _repository = repository;
     _logger     = logger;
 }
Exemple #10
0
 public WeatherService()
 {
     _favoriteCityRepository    = new FavoriteCitiesRepository();
     _weatherForecastRepository = new WeatherForecastRepository();
 }