public bool Fetch()
        {
            if (_dataQuery.ListEntries.IsNullOrEmpty())
            {
                if (_dataQuery.SearchCriteria == null)
                {
                    Items = Array.Empty <IEntity>();
                }
                else
                {
                    var searchCriteria = BuildSearchCriteria(_dataQuery);
                    var searchResult   = _listEntrySearchService.Search(searchCriteria);
                    Items = searchResult.ListEntries;
                }
            }
            else
            {
                var skip     = GetSkip();
                var take     = GetTake();
                var entities = GetNextItems(_dataQuery.ListEntries, skip, take);
                Items = entities.ToArray();
            }

            _pageNumber++;

            return(Items.Any());
        }
Example #2
0
        public ActionResult ListItemsSearch([FromBody] CatalogListEntrySearchCriteria criteria)
        {
            //TODO:
            //ApplyRestrictionsForCurrentUser(coreModelCriteria);
            var result = _listEntrySearchService.Search(criteria);

            return(Ok(result));
        }
        private ListEntrySearchResult SearchProductsInCategories(string[] categoryIds, int skip, int take)
        {
            var searchCriteria = new SearchCriteria
            {
                CategoryIds        = categoryIds,
                Skip               = skip,
                Take               = take,
                ResponseGroup      = SearchResponseGroup.WithProducts,
                SearchInChildren   = true,
                SearchInVariations = true
            };

            var result = _listEntrySearchService.Search(searchCriteria);

            return(result);
        }
        private webModel.ListEntrySearchResult SearchListEntries(webModel.SearchCriteria criteria)
        {
            var coreModelCriteria = criteria.ToCoreModel();

            ApplyRestrictionsForCurrentUser(coreModelCriteria);

            coreModelCriteria.WithHidden = true;

            // need search in children categories if user specify keyword
            if (!string.IsNullOrEmpty(coreModelCriteria.Keyword))
            {
                coreModelCriteria.SearchInChildren   = true;
                coreModelCriteria.SearchInVariations = true;
            }

            return(_listEntrySearchService.Search(coreModelCriteria));
        }
        public IHttpActionResult ListItemsSearch(webModel.SearchCriteria criteria)
        {
            var coreModelCriteria = criteria.ToCoreModel();

            ApplyRestrictionsForCurrentUser(coreModelCriteria);

            coreModelCriteria.WithHidden = true;

            // need search in children categories if user specify keyword
            if (!string.IsNullOrEmpty(coreModelCriteria.Keyword))
            {
                coreModelCriteria.SearchInChildren   = true;
                coreModelCriteria.SearchInVariations = true;
            }

            var result = _listEntrySearchService.Search(coreModelCriteria);

            return(Ok(result));
        }