private void EnrichFramework(ApprenticeshipFavouriteRead apprenticeship)
        {
            var framework = _getFrameworks.GetFrameworkById(apprenticeship.ApprenticeshipId);

            apprenticeship.Title              = framework.Title;
            apprenticeship.Duration           = framework.Duration;
            apprenticeship.Level              = framework.Level;
            apprenticeship.EffectiveTo        = framework.EffectiveTo;
            apprenticeship.ApprenticeshipType = ApprenticeshipType.Framework;
            apprenticeship.Active             = framework.IsActiveFramework;
        }
        private void EnrichStandard(ApprenticeshipFavouriteRead apprenticeship)
        {
            var standard = _getStandards.GetStandardById(apprenticeship.ApprenticeshipId);

            apprenticeship.Title              = standard.Title;
            apprenticeship.Duration           = standard.Duration;
            apprenticeship.Level              = standard.Level;
            apprenticeship.EffectiveTo        = standard.EffectiveTo;
            apprenticeship.ApprenticeshipType = ApprenticeshipType.Standard;
            apprenticeship.Active             = standard.IsActiveStandard;
        }
        private void EnrichTrainingProvider(ApprenticeshipFavouriteRead apprenticeship)
        {
            foreach (var providerItem in apprenticeship.Providers)
            {
                var providerResult = _getProvider.GetProviderDetails(providerItem.Ukprn).GetAwaiter().GetResult();

                if (providerResult != null)
                {
                    providerItem.Name   = providerResult.ProviderName;
                    providerItem.Active = true;
                }
            }
        }
        private void EnrichApprenticeshipInfo(ApprenticeshipFavouriteRead apprenticeship)
        {
            var apprenticeshipRead = new ApprenticeshipFavouriteRead()
            {
                ApprenticeshipId = apprenticeship.ApprenticeshipId
            };

            if (IsFramework(apprenticeship.ApprenticeshipId))
            {
                EnrichFramework(apprenticeship);
            }
            else
            {
                EnrichStandard(apprenticeship);
            }

            EnrichTrainingProvider(apprenticeship);
        }
Example #5
0
        public ApprenticeshipBasketItemViewModel Map(ApprenticeshipFavouriteRead source)
        {
            var item = new ApprenticeshipBasketItemViewModel()
            {
                Id               = source.ApprenticeshipId,
                Title            = source.Title,
                Level            = source.Level,
                Duration         = source.Duration,
                EffectiveTo      = source.EffectiveTo,
                TrainingProvider = source.Providers.Select(s => new TrainingProviderSearchResultsItem()
                {
                    Ukprn = s.Ukprn, Name = s.Name, Active = s.Active, LocationId = s.Locations.FirstOrDefault()
                }).ToList(),
                ApprenticeshipType = source.ApprenticeshipType,
                Active             = source.Active
            };

            return(item);
        }
 public RemoveConfirmationViewModel(ApprenticeshipFavouriteRead apprenticeshipItem, string returnPath)
 {
     ApprenticeshipItem = apprenticeshipItem;
     ReturnPath         = returnPath;
 }