Exemplo n.º 1
0
        public virtual async Task <TEntity> InsertAsync(TEntity model)
        {
            await _dbContext.AddAsync(model);

            await _dbContext.SaveChangesAsync();

            return(model);
        }
        /// <inheritdoc />
        public async Task <Reservation> SetReservationCheckInDate(string reservationId)
        {
            var reservation = await _dbContext.Reservations.FindAsync(reservationId);

            //only allow manager to set actual check in date if actual check in and check out date dont yet exist already
            if (reservation != null && reservation.ActualCheckIn == null && reservation.ActualCheckOut == null)
            {
                reservation.ActualCheckIn = DateTime.UtcNow;
                _dbContext.Reservations.Update(reservation);
                await _dbContext.SaveChangesAsync();

                return(reservation);
            }

            return(null);
        }
Exemplo n.º 3
0
 public async Task RemoveReservationByConfirmationNumber(string confirmationNumber)
 {
     _dbContext.Reservations.Remove(GetReservationByConfirmationNumber(confirmationNumber));
     await _dbContext.SaveChangesAsync();
 }