public MyApplicationsViewModel( IEnumerable <MyApprenticeshipApplicationViewModel> apprenticeshipApplications, IEnumerable <MyTraineeshipApplicationViewModel> traineeshipApplications, TraineeshipFeatureViewModel traineeshipFeature) { AllApprenticeshipApplications = apprenticeshipApplications .Where(a => !a.IsArchived) .OrderByDescending(a => a.DateUpdated); TraineeshipApplications = traineeshipApplications .Where(a => !a.IsArchived) .OrderByDescending(a => a.DateApplied); TraineeshipFeature = traineeshipFeature; }
private TraineeshipFeatureViewModel GetTraineeshipFeatureViewModel(Guid candidateId, IList <ApprenticeshipApplicationSummary> apprenticeshipApplicationSummaries, IList <TraineeshipApplicationSummary> traineeshipApplicationSummaries) { var candididate = _candidateService.GetCandidate(candidateId); var unsuccessfulApplicationsToShowTraineeshipsPrompt = _configurationManager.GetCloudAppSetting <int>("UnsuccessfulApplicationsToShowTraineeshipsPrompt"); var allowTraineeshipPrompts = candididate.CommunicationPreferences.AllowTraineeshipPrompts; var sufficentUnsuccessfulApprenticeshipApplicationsToPrompt = apprenticeshipApplicationSummaries.Count(each => each.Status == ApplicationStatuses.Unsuccessful) >= unsuccessfulApplicationsToShowTraineeshipsPrompt; var candidateHasSuccessfulApprenticeshipApplication = apprenticeshipApplicationSummaries.Any(each => each.Status == ApplicationStatuses.Successful); var candidateHasAppliedForTraineeship = traineeshipApplicationSummaries.Any(); var viewModel = new TraineeshipFeatureViewModel { ShowTraineeshipsPrompt = allowTraineeshipPrompts && sufficentUnsuccessfulApprenticeshipApplicationsToPrompt && !candidateHasSuccessfulApprenticeshipApplication && !candidateHasAppliedForTraineeship, ShowTraineeshipsLink = (sufficentUnsuccessfulApprenticeshipApplicationsToPrompt || candidateHasAppliedForTraineeship) }; return(viewModel); }
public MyApplicationsViewModelBuilder With(TraineeshipFeatureViewModel traineeshipFeatureViewModel) { _traineeshipFeatureViewModel = traineeshipFeatureViewModel; return(this); }
public MyApplicationsViewModelBuilder() { _apprenticeshipApplicationViewModels = new List <MyApprenticeshipApplicationViewModel>(); _traineeshipApplicationViewModels = new List <MyTraineeshipApplicationViewModel>(); _traineeshipFeatureViewModel = new TraineeshipFeatureViewModel(); }