protected override int ResolveCore(BaseProviderSearchResults source)
        {
            if (source == null)
            {
                return(0);
            }

            return(SearchMappingHelper.CalculateLastPage(source.TotalResults, source.ResultsToTake));
        }
Ejemplo n.º 2
0
        private static void CreateApprenticeshipSearchResultsMappings(IMapperConfiguration cfg)
        {
            // Apprenticeship search listing  -> mix of standard and framework
            cfg.CreateMap <ApprenticeshipSearchResponse, ApprenticeshipSearchResultViewModel>()
            .ForMember(x => x.SearchViewModel, opt => opt.Ignore())
            .ForMember(x => x.AggregationLevel, opt => opt.ResolveUsing <AggregationLevelValueResolver>())
            .ForMember(x => x.LastPage, y => y.MapFrom(z => SearchMappingHelper.CalculateLastPage(z.TotalResults, z.ResultsToTake)));

            // Nexzt
            cfg.CreateMap <ApprenticeshipSearchResultsItem, ApprenticeshipSearchResultItemViewModel>()
            .ForMember(x => x.ApprenticeshipType, y => y.Ignore())     // set in aftermap
            .AfterMap <ApprenticeshipSearchResultItemViewModelMappingAction>();
        }
Ejemplo n.º 3
0
 public void ShouldCalculateLastPage(long totalResults, int resultsToTake, int expected)
 {
     SearchMappingHelper.CalculateLastPage(totalResults, resultsToTake).Should().Be(expected);
 }