public CurrentPageViewModel( SearchSortFilterPaginationResult <CurrentLearningItem> result, bool apiIsAccessible, string?bannerText ) : base(result, false, searchLabel: "Search your current courses") { ApiIsAccessible = apiIsAccessible; BannerText = bannerText; CurrentActivities = result.ItemsToDisplay.Select <BaseLearningItem, CurrentLearningItemViewModel>( activity => { return(activity switch { CurrentCourse currentCourse => new CurrentCourseViewModel( currentCourse, result.GetReturnPageQuery($"{currentCourse.Id}-course-card") ), SelfAssessment selfAssessment => new SelfAssessmentCardViewModel( selfAssessment, result.GetReturnPageQuery($"{selfAssessment.Id}-sa-card") ), _ => new CurrentLearningResourceViewModel( (ActionPlanResource)activity, result.GetReturnPageQuery($"{activity.Id}-lhr-card") ), }); }
public AllDelegatesViewModel( SearchSortFilterPaginationResult <DelegateUserCard> result, IReadOnlyCollection <CentreRegistrationPrompt> centreRegistrationPrompts, IEnumerable <FilterModel> availableFilters ) : base( result, true, availableFilters, "Search delegates" ) { var promptsWithOptions = centreRegistrationPrompts.Where(registrationPrompt => registrationPrompt.Options.Count > 0); Delegates = result.ItemsToDisplay.Select( delegateUser => { var delegateRegistrationPrompts = PromptsService.GetDelegateRegistrationPrompts(delegateUser, centreRegistrationPrompts); return(new SearchableDelegateViewModel( delegateUser, delegateRegistrationPrompts, promptsWithOptions, result.GetReturnPageQuery($"{delegateUser.Id}-card") )); } ); }
public DelegateGroupsViewModel( SearchSortFilterPaginationResult <Group> result, IEnumerable <FilterModel> availableFilters ) : base(result, true, availableFilters) { DelegateGroups = result.ItemsToDisplay.Select(g => { var cardId = $"{g.GroupId}-card"; return(new SearchableDelegateGroupViewModel(g, result.GetReturnPageQuery(cardId))); } ); }
public CentreAdministratorsViewModel( int centreId, SearchSortFilterPaginationResult <AdminUser> result, IEnumerable <FilterModel> availableFilters, AdminUser loggedInAdminUser ) : base( result, true, availableFilters, "Search administrators" ) { CentreId = centreId; Admins = result.ItemsToDisplay.Select( adminUser => new SearchableAdminViewModel( adminUser, loggedInAdminUser, result.GetReturnPageQuery($"{adminUser.Id}-card") ) ); }
public SelectedCourseDetailsViewModel( SearchSortFilterPaginationResult <CourseDelegate> result, IEnumerable <FilterModel> availableFilters, CourseDelegatesData courseDelegatesData, Dictionary <string, string> routeData ) : base(result, true, availableFilters, routeData: routeData) { var currentCourse = courseDelegatesData.Courses.Single(c => c.CustomisationId == courseDelegatesData.CustomisationId); Active = currentCourse.Active; Delegates = result.ItemsToDisplay.Select( d => new DelegateCourseInfoViewModel( d, DelegateAccessRoute.CourseDelegates, result.GetReturnPageQuery($"{d.DelegateId}-card") ) ); Filters = CourseDelegateViewModelFilterOptions.GetAllCourseDelegatesFilterViewModels( courseDelegatesData.CourseAdminFields ); }
public RecommendedLearningViewModel( CurrentSelfAssessment selfAssessment, SearchSortFilterPaginationResult <RecommendedResource> result, bool apiIsAccessible ) : base( result, false, searchLabel: "Search resources" ) { ApiIsAccessible = apiIsAccessible; SelfAssessment = selfAssessment; RecommendedResources = result.ItemsToDisplay.Select( r => new SearchableRecommendedResourceViewModel( r, selfAssessment.Id, result.GetReturnPageQuery($"{r.LearningHubReferenceId}-card") ) ); }