Beispiel #1
0
 public void Add(params T[] items)
 {
     foreach (T item in items)
     {
         _context.Entry(item).State = EntityState.Added;
     }
     _context.SaveChanges();
 }
Beispiel #2
0
        public ActionResult <Reservation> GetOneById(long id)
        {
            var item = _context.Reservations.Find(id);

            if (item == null)
            {
                return(NotFound());
            }
            _context.Entry(item).Reference("Room").Load();
            return(item);
        }
Beispiel #3
0
        public bool Update(Booking booking)
        {
            var cache = context.Bookings.FirstOrDefault(o => o.Id == booking.Id);

            if (cache != null)
            {
                context.Entry(cache).CurrentValues.SetValues(booking);
                context.SaveChanges();
                return(true);
            }

            return(false);
        }
 public bool Update(Room room)
 {
     db.Entry(room).State = EntityState.Modified;
     return(true);
 }