Ejemplo n.º 1
0
        public async Task ValidateAsync(IReservationContainer reservationContainer)
        {
            if (reservationContainer == null)
            {
                throw new ArgumentNullException(nameof(reservationContainer));
            }

            var reservation = await this.GetBy(reservationContainer);

            if (reservationContainer.ReservationId.HasValue && reservation == null)
            {
                throw new InvalidOperationException($"Reservation not found by id {reservationContainer.ReservationId}");
            }
        }
Ejemplo n.º 2
0
 public async Task <Reservation> GetByAsync(IReservationContainer reservation)
 {
     return(reservation.ReservationId.HasValue
         ? this.Mapper.Map <Reservation>(await this.Context.Reservation.FirstOrDefaultAsync(x => x.Id == reservation.ReservationId))
         : null);
 }
Ejemplo n.º 3
0
 private Task <Reservation> GetBy(IReservationContainer departmentContainer)
 {
     return(this.ReservationDataAccess.GetByAsync(departmentContainer));
 }