public async Task <IActionResult> PutBench([FromRoute] int id, [FromBody] Bench bench) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bench.Id) { return(BadRequest()); } _context.Entry(bench).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BenchExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <BookAppointment> Add(BookAppointment appointment) { await context.Appointments.AddAsync(appointment); await context.SaveChangesAsync(); return(appointment); }