Example #1
0
        public async Task <int> CountCategories(string phrase, int sortType)
        {
            var searcher = new CategorySearchHelper(_context);

            return(await searcher
                   .Active()
                   .IncludeCountPublic()
                   .Like(phrase)
                   .Count());
        }
Example #2
0
        public async Task <ICollection <Category> > SearchCategories()
        {
            var searcher = new CategorySearchHelper(_context);

            return(await searcher
                   .Active()
                   .IncludeCountPublic()
                   .SortBy(Consts.SortType.Popularity)
                   .Get());
        }
Example #3
0
        public async Task <ICollection <Category> > SearchTopCategories(int top)
        {
            var searcher = new CategorySearchHelper(_context);
            var col      = await searcher
                           .Active()
                           .IncludeCountPublic()
                           .Get();

            return(col.OrderByDescending(c => c.ProductCount).Where(c => c.ProductCount > 0).Take(top).ToList());
        }
Example #4
0
        public async Task <ICollection <Category> > SearchCategories(string phrase, int sortType, int page, int pageSize)
        {
            var searcher = new CategorySearchHelper(_context);

            return(await searcher
                   .Active()
                   .IncludeCountPublic()
                   .Like(phrase)
                   .SortBy((Consts.SortType)sortType)
                   .Page(page, pageSize)
                   .Get());
        }
Example #5
0
        public async Task <ICollection <Category> > GetCategoryDistribution()
        {
            var catHelper = new CategorySearchHelper(_context);

            return(await catHelper.Active().IncludeCountHidden().Get());
        }