예제 #1
0
        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,
            };

            return(result);
        }
        public SearchPagedResult(SearchFilterRequest filterOptions, int totalCount)
        {
            Guard.ArgumentNotNull(filterOptions, nameof(filterOptions));

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

            if (totalCount == 0)
            {
                TotalPages = 0;
            }
            else
            {
                TotalPages = (int)Math.Ceiling((decimal)totalCount / filterOptions.PageSize);
            }
        }