Example #1
0
        public M.Reservation Create(M.Reservation model)
        {
            var reservation = new DB.Reservation()
            {
                CustomerID    = model.CustomerID,
                RoomID        = model.RoomID,
                Departure     = model.Departure,
                Entry         = model.Entry,
                Paid          = model.Paid,
                PaymentMethod = (DB.Enum.PaymentMethod)model.PaymentMethod,
                Status        = (DB.Enum.ReservationStatus)model.Status,
                Fee           = model.Fee
            };

            var room = _roomRepo.GetById(model.RoomID);

            room.Status = DB.Enum.RoomStatus.Dirty;
            _roomRepo.Update(room);

            _reservationRepo.Create(reservation);

            UnitOfWork.SaveChanges();

            model.ID = reservation.ID;

            return(model);
        }
Example #2
0
        public void Update(M.Reservation model)
        {
            var item = _reservationRepo.GetById(model.ID);

            item.CustomerID    = model.CustomerID;
            item.RoomID        = model.RoomID;
            item.Departure     = model.Departure;
            item.Entry         = model.Entry;
            item.Paid          = model.Paid;
            item.PaymentMethod = (DB.Enum.PaymentMethod)model.PaymentMethod;
            item.Status        = (DB.Enum.ReservationStatus)model.Status;
            item.Fee           = model.Fee;
            _reservationRepo.Update(item);
            UnitOfWork.SaveChanges();
        }