Exemplo n.º 1
0
        internal static SearchResult <MultiSearch> CreateMultiSearch(SearchResultDTO searchResult)
        {
            if (searchResult == null)
            {
                return(null);
            }

            searchResult.Results = searchResult.Results ?? Array.Empty <SearchResultItemDTO>();

            var results = SearchResultItemFactory.Create(searchResult.Results);

            return(new SearchResult <MultiSearch>(results, searchResult.Page, searchResult.TotalResults, searchResult.TotalPages));
        }
Exemplo n.º 2
0
        internal static SearchResult <IList <T> > CreateList <T>(SearchResultDTO searchResult)
        {
            if (searchResult == null)
            {
                return(null);
            }

            searchResult.Results = searchResult.Results ?? Array.Empty <SearchResultItemDTO>();

            var results = new List <T>();

            foreach (var serachResultItem in searchResult.Results)
            {
                results.Add(SearchResultItemFactory.Create <T>(serachResultItem));
            }

            return(new SearchResult <IList <T> >(results, searchResult.Page, searchResult.TotalResults, searchResult.TotalPages));
        }