public async Task <ActionResult <WeatherForeCast> > PostWeatherForeCast(WeatherForeCast weatherForeCast) { _context.WeatherForeCasts.Add(weatherForeCast); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWeatherForeCast", new { id = weatherForeCast.Id }, weatherForeCast)); }
public async Task <IActionResult> PutWeatherForeCast(long id, WeatherForeCast weatherForeCast) { if (id != weatherForeCast.Id) { return(BadRequest()); } _context.Entry(weatherForeCast).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WeatherForeCastExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }