Esempio n. 1
0
        public async Task <T> LoadFullCart <T>(CartPersistenceModel cart, CancellationToken cancellationToken) where T : CartModel, new()
        {
            T cartModel = new T()
            {
                CarReservationDuration   = cart.CarReservationDuration,
                HotelReservationDuration = cart.HotelReservationDuration
            };

            if (cart.DepartingFlight != 0)
            {
                cartModel.DepartingFlight = await _flightDataProvider.FindFlight(cart.DepartingFlight, cancellationToken);
            }

            if (cart.ReturningFlight != 0)
            {
                cartModel.ReturningFlight = await _flightDataProvider.FindFlight(cart.ReturningFlight, cancellationToken);
            }

            if (cart.HotelReservation != 0)
            {
                cartModel.HotelReservation = await _hotelDataProvider.FindHotel(cart.HotelReservation, cancellationToken);
            }

            if (cart.CarReservation != 0)
            {
                cartModel.CarReservation = await _carDataProvider.FindCar(cart.CarReservation, cancellationToken);
            }

            return(cartModel);
        }
Esempio n. 2
0
 public async Task <FlightModel> FindFlight(int flightId, CancellationToken cancellationToken)
 {
     return(await _flightDataProvider.FindFlight(flightId, cancellationToken));
 }