Пример #1
0
        public GetProductsByCategoryResponse GetProductsByCategory(GetProductsByCategoryRequest request)
        {
            var query = ProductSearchRequestQueryGenerator.CreateQueryFor(request);

            var products = _productRepository.FindBy(query);

            var response = products.CreateResultFrom(request);

            response.SelectedCategoryName = _categoryRepository.FindBy(request.CategoryId).Name;

            return(response);
        }
Пример #2
0
        public GetProductsByCategoryResponse GetProductsByCategory(GetProductsByCategoryRequest request)
        {
            GetProductsByCategoryResponse response;

            Expression <Func <Product, bool> > query = ProductSearchRequestQueryGenerator.CreateQuery(request);

            IEnumerable <Product> productsMatchingRefinement = GetAllProductsMatchingQueryAndSort(request, query);

            response = productsMatchingRefinement.CreateProductSearchResultFrom(request);
            response.SelectedCategoryName = _categoryRepository.GetById(request.CategoryId).Name;

            return(response);
        }