示例#1
0
        public SearchPagedResult(SearchFilterRequest filterOptions, int totalCount, int totalErrorCount = 0)
        {
            Guard.ArgumentNotNull(filterOptions, nameof(filterOptions));

            TotalItems      = totalCount;
            TotalErrorItems = totalErrorCount;
            PageNumber      = filterOptions.Page;
            PageSize        = filterOptions.PageSize;

            if (totalCount == 0)
            {
                TotalPages = 0;
            }
            else
            {
                TotalPages = (int)Math.Ceiling((decimal)totalCount / filterOptions.PageSize);
            }
        }
        public static SearchQueryRequest FromSearchFilterRequest(SearchFilterRequest filterOptions)
        {
            Guard.ArgumentNotNull(filterOptions, nameof(filterOptions));

            SearchQueryRequest result = new SearchQueryRequest()
            {
                PageNumber    = filterOptions.Page,
                Top           = filterOptions.PageSize,
                SearchTerm    = filterOptions.SearchTerm,
                IncludeFacets = filterOptions.IncludeFacets,
                Filters       = filterOptions.Filters,
                FacetCount    = filterOptions.FacetCount,
                SearchMode    = filterOptions.SearchMode,
                ErrorToggle   = filterOptions.ErrorToggle
            };

            return(result);
        }