public async Task <SearchCarAdsOutputModel> Handle( SearchCarAdsQuery request, CancellationToken cancellationToken) { var carAdListings = await this.carAdRepository.GetCarAdListings( request.Manufacturer, cancellationToken); var totalCarAds = await this.carAdRepository.Total(cancellationToken); return(new SearchCarAdsOutputModel(carAdListings, totalCarAds)); }
public async Task <SearchCarAdsOutputModel> Handle( SearchCarAdsQuery request, CancellationToken cancellationToken) { var carAdSpecification = new CarAdByManufacturerSpecification(request.Manufacturer) .And(new CarAdByCategorySpecification(request.Category)) .And(new CarAdByPricePerDaySpecification(request.MinPricePerDay, request.MaxPricePerDay)); var carAdListings = await this.carAdRepository.GetCarAdListings(carAdSpecification, cancellationToken); var totalCarAds = await this.carAdRepository.Total(cancellationToken); return(new SearchCarAdsOutputModel(carAdListings, totalCarAds)); }