Пример #1
0
        public ProductWithTypesAndBrandsSpecification(ProductSpecParams productParams)
            : base(ProductFilterExpressionGenerator.Generate(productParams))
        {
            AddIncludes();

            if (!string.IsNullOrEmpty(productParams.Sort))
            {
                switch (productParams.Sort)
                {
                case "priceAsc":
                    AddOrderBy(p => p.Price);
                    break;

                case "priceDesc":
                    AddOrderByDescending(p => p.Price);
                    break;

                default:
                    AddOrderBy(p => p.Name);
                    break;
                }
            }
            else
            {
                AddOrderBy(p => p.Name);
            }

            ApplyPaging(productParams.Skip, productParams.PageSize);
        }
 public ProductWithFiltersForCountSpecification(ProductSpecParams productParams)
     : base(ProductFilterExpressionGenerator.Generate(productParams))
 {
 }