public async Task <IActionResult> PostRestOnWaterSerAtTour([FromBody] RestOnWaterSerAtTour restOnWaterSerAtTour) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.RestOnWaterSerAtTour.Add(restOnWaterSerAtTour); await _context.SaveChangesAsync(); return(CreatedAtAction("GetRestOnWaterSerAtTour", new { id = restOnWaterSerAtTour.RestOnWaterSerAtTourId }, restOnWaterSerAtTour)); }
public async Task <IActionResult> PutRestOnWaterSerAtTour([FromRoute] int id, [FromBody] RestOnWaterSerAtTour restOnWaterSerAtTour) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != restOnWaterSerAtTour.RestOnWaterSerAtTourId) { return(BadRequest()); } _context.Entry(restOnWaterSerAtTour).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RestOnWaterSerAtTourExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }