Ejemplo n.º 1
0
        private static async Task Test()
        {
            //var radarImages = await EstonianWeatherService.GetRadar();
            //var observations = await EstonianWeatherService.GetObservations();
            var estonianForecast = await EstonianWeatherService.GetForecast();

            var finnish   = new FinnishMeteorologicalInstitute("5a1f4db3-a07e-49c9-9513-e4e574dedf9d");
            var forecasts = await finnish.GetForecasts("tallinn");

            var parameterNames = forecasts.Members.Where(x => x.BsWfsElement.Time.Contains("2019-01-25T09"))
                                 .Select(x => x.BsWfsElement.ParameterName);
        }
Ejemplo n.º 2
0
        private static async Task Run()
        {
            var config = new ConfigurationBuilder()
                         .SetBasePath(Directory.GetCurrentDirectory())
                         .AddJsonFile("config.json", optional: true, reloadOnChange: true)
                         .Build();

            var connectionString =
                config.GetConnectionString("EstonianWeather.Data.ApplicationDbContext");

            using (var db = new ApplicationDbContext(connectionString))
            {
                var finnishForecastService = new FinnishForecastService(db);
                var finnish = new FinnishMeteorologicalInstitute(config.GetValue <string>("FinnishMeteorologicalInstitute.ApiKey"));

                var requestId       = Guid.NewGuid();
                var requestTime     = DateTimeOffset.UtcNow;
                var requestLocation = "tallinn";
                var forecasts       = await finnish.GetForecasts(requestLocation);

                await finnishForecastService.Save(requestId, requestTime, requestLocation, forecasts);
            }
        }