コード例 #1
0
        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
     });
 }
コード例 #4
0
 public async Task Insert(WeatherForecast weatherForecast)
 {
     await _weatherForecastRepository.Add(weatherForecast);
 }