public async Task <IActionResult> PutCalendar(string calendarName, Calendar calendar) { if (calendarName != calendar.CalendarName) { return(BadRequest()); } _context.Entry(calendar).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CalendarExists(calendarName)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAppointment(int id, Appointment appointment) { if (id != appointment.ID) { return(BadRequest()); } appointment.StartDate = appointment.StartDate.Date; appointment.EndDate = appointment.EndDate.Date; _context.Entry(appointment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCustomer(int id, Customer customer) { if (id != customer.ID) { return(BadRequest()); } _context.Entry(customer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }