Beispiel #1
0
        public OpenWeather ConvertOpenWeatherDtoInOpenWeather(OpenWeatherDto weatherDto)
        {
            OpenWeatherCoordinate coordinate = new OpenWeatherCoordinate(
                weatherDto.Coord.Lon,
                weatherDto.Coord.Lat);

            OpenWeatherMain weatherMain = new OpenWeatherMain(
                weatherDto.Main.Temp,
                weatherDto.Main.FeelsLike,
                weatherDto.Main.TempMin,
                weatherDto.Main.TempMax,
                weatherDto.Main.Pressure,
                weatherDto.Main.Humidity);

            OpenWeather openWeather = new OpenWeather(
                weatherDto.Base,
                weatherDto.Visibility,
                weatherDto.Dt,
                weatherDto.Timezone,
                weatherDto.Name,
                weatherDto.Cod);

            openWeather.AddCoordinate(coordinate);
            openWeather.AddWeatherMain(weatherMain);

            return(openWeather);
        }
Beispiel #2
0
        public async Task PersistOpenWeather(OpenWeatherDto openWeatherDto)
        {
            await _weatherRepository.AddAsync(ConvertOpenWeatherDtoInOpenWeather(openWeatherDto));

            await _weatherRepository.UnitOfWork.Commit();
        }