public async Task <List <TourDto> > Handle(GetToursQuery request, CancellationToken cancellationToken) { var pipeline = _pipelineBuilder .WithNode(new AgencyPipelineNode(request.Agencies)) .WithNode(new CategoryPipelineNode(request.Categories)) .WithNode(new NamePipelineNode(request.Name)) .WithNode(new PriceRangePipelineNode(request.MinPrice, request.MaxPrice)) .WithNode(new TimeOfTheYearPipelineNode(request.TimeOfTheYear)) .WithNode(new DestinationPointPipelineNode(request.DestinationPointId)) .Execute(); var filter = pipeline.Execute(); var sortOption = _sortOptionFactory.Create <Tour>(request.SortOption); var tours = await _toursRepository.FindAllAsync( filter, sortOption.Expression, sortOption.Direction, GetSkipValue(request.PageNumber, request.PageSize), request.PageSize); var toursDto = _mapper.Map <List <Tour>, List <TourDto> >(tours); return(toursDto); }
public async Task <List <LocationDto> > Handle(GetLocationsQuery request, CancellationToken cancellationToken) { var locations = await _locationRepository.FindAllAsync(); var locationsDtos = _mapper.Map <List <Location>, List <LocationDto> >(locations); return(locationsDtos); }
public async Task <List <AgencyDto> > Handle(GetAgenciesQuery request, CancellationToken cancellationToken) { var agencies = await _agencyRepository.FindAllAsync(); var agenciesDto = _mapper.Map <List <Agency>, List <AgencyDto> >(agencies); return(agenciesDto); }
public async Task <List <HotelDto> > Handle(GetHotelsQuery request, CancellationToken cancellationToken) { var hotels = await _hotelRepository.FindAllAsync(); var hotelsDto = _mapper.Map <List <HotelDto> >(hotels); return(hotelsDto); }
public async Task <List <TourDto> > Handle(GetHotToursQuery request, CancellationToken cancellationToken) { var tours = await _tourReadonlyRepository.FindAllAsync(sort : tour => tour.Visits, take : request.Limit); var tourDtos = _mapper.Map <List <Tour>, List <TourDto> >(tours); return(tourDtos); }
public async Task <List <CategoryDto> > Handle(GetCategoriesQuery request, CancellationToken cancellationToken) { var categories = await _categoryRepository.FindAllAsync(); var categoriesDto = _mapper.Map <List <Category>, List <CategoryDto> >(categories); return(categoriesDto); }