public async Task <FlightReservationModel> Search(SearchModel searchRequest, CancellationToken cancellationToken) { FlightReservationModel roundTrip = new FlightReservationModel(); roundTrip.DepartingFlights = await _flightDataProvider.FindFlights(searchRequest.StartLocation, searchRequest.EndLocation, searchRequest.StartDate, THREEHOURSBEFOREORAFTER, cancellationToken); roundTrip.ReturningFlights = await _flightDataProvider.FindFlights(searchRequest.EndLocation, searchRequest.StartLocation, searchRequest.EndDate, THREEHOURSBEFOREORAFTER, cancellationToken); if (searchRequest.IsTest) { roundTrip.SelectedDepartingFlight = roundTrip.DepartingFlights.Skip(TestSettings.random.Next(roundTrip.DepartingFlights.Count() - 1)).First().Id; } if (searchRequest.IsTest) { roundTrip.SelectedReturningFlight = roundTrip.ReturningFlights.Skip(TestSettings.random.Next(roundTrip.ReturningFlights.Count() - 1)).First().Id; } return(roundTrip); }
public async Task <IEnumerable <FlightModel> > FindFlights(string departingFrom, string arrivingAt, DateTimeOffset desiredTime, TimeSpan offset, CancellationToken cancellationToken) { return(await _flightDataProvider.FindFlights(departingFrom, arrivingAt, desiredTime, offset, cancellationToken)); }