public async Task <IActionResult> PutDoctor(int id, Doctor doctor) { if (id != doctor.DoctorId) { return(BadRequest()); } _context.Entry(doctor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoctorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPatient(int id, Patient patient) { if (id != patient.PatientId) { return(BadRequest()); } _context.Entry(patient).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PatientExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IQueryable <Booking> DeleteBooking(int id) { IQueryable <Booking> bookings = _context.Booking.Where(a => a.BookingId == id); _context.Booking.Remove(bookings.FirstOrDefault()); _context.SaveChangesAsync(); return(bookings); }