public int Add(d.Booking newBooking) { var entity = new Booking { Date = newBooking.Date, DoctorId = newBooking.DoctorId, PatientId = newBooking.UserId, Description = newBooking.Description }; _context.Bookings.Add(entity); _context.SaveChanges(); return(entity.BookingId); }
public void Update(d.Booking newBooking) { var entity = _context.Bookings.Find(newBooking.BookingId); if (entity == null) { throw new ArgumentNullException(); } entity.Description = newBooking.Description; entity.Date = DateTime.Now; entity.DoctorId = newBooking.DoctorId; entity.PatientId = newBooking.UserId; _context.Bookings.Update(entity); _context.SaveChanges(); }