private void AddLog(string logData, string zipCode)
        {
            JObject json = JObject.Parse(logData);

            var dto = new WeatherForecastEntity
            {
                Timestamp   = DateTime.Now,
                ZipCode     = zipCode,
                Temperature = (int)json["temperature"]
            };

            _weatherForecastRepository.Add(dto);
        }
示例#2
0
        public async Task <IActionResult> CreateWeatherForecast([FromBody] WeatherForecast weatherForecast)
        {
            var result = await _weatherRepository.Add(weatherForecast);

            return(CreatedAtRoute(nameof(GetSingleWeatherForecast), new { weatherForecastID = result.Id }, result));
        }
示例#3
0
 public void AddWeatherForecastModel(WeatherForecastModel weather)
 {
     repository.Add(new WeatherForecastEntity {
         Date = weather.Date, Summary = weather.Summary, TemperatureC = weather.TemperatureC
     });
 }
 public async Task Insert(WeatherForecast weatherForecast)
 {
     await _weatherForecastRepository.Add(weatherForecast);
 }