public async Task <CarReservationModel> Search(SearchModel searchRequest, CancellationToken cancellationToken) { CarReservationModel carReservation = new CarReservationModel() { NumberOfDays = searchRequest.EndDate.Subtract(searchRequest.StartDate).TotalDays }; carReservation.Cars = await _carDataProvider.FindCars(searchRequest.StartLocation, searchRequest.StartDate, cancellationToken); if (searchRequest.IsTest) { carReservation.SelectedCar = carReservation.Cars.Skip(TestSettings.random.Next(carReservation.Cars.Count() - 1)).First().Id; } return(carReservation); }
public async Task <IEnumerable <CarModel> > FindCars(string location, DateTimeOffset desiredTime, CancellationToken cancellationToken) { return(await _carDataProvider.FindCars(location, desiredTime, cancellationToken)); }