예제 #1
0
        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);
        }
예제 #2
0
        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();
        }