コード例 #1
0
 public HttpStatusController(IEastSussexGovUKTemplateRequest templateRequest, IViewModelDefaultValuesProvider defaultModelValues, INotFoundRequestPathResolver notFoundRequestPathResolver, IRedirectMatcher redirectMatcher, IConvertToAbsoluteUrlHandler convertToAbsoluteUrlHandler, IPreserveQueryStringHandler preserveQueryStringHandler)
 {
     _templateRequest             = templateRequest;
     _defaultModelValues          = defaultModelValues;
     _notFoundRequestPathResolver = notFoundRequestPathResolver;
     _redirectMatcher             = redirectMatcher;
     _convertToAbsoluteUrlHandler = convertToAbsoluteUrlHandler;
     _preserveQueryStringHandler  = preserveQueryStringHandler;
 }
コード例 #2
0
        private async static Task <GuideViewModel> MapUmbracoContentToViewModel(IPublishedContent content, DateTime?expiryDate, IEastSussexGovUKTemplateRequest templateRequest)
        {
            var stepPages = content.Children <IPublishedContent>().Where(child => child.ContentType.Alias == "GuideStep");
            var steps     = new List <GuideStepViewModel>();

            foreach (var step in stepPages)
            {
                steps.Add(await MapUmbracoContentToGuideStepViewModel(step, templateRequest));
            }
            var model = new GuideViewModel()
            {
                Steps = steps
            };

            var sectionNavigation = content.GetPropertyValue <int>("SectionNavigation_Navigation");

            model.StepsHaveAnOrder = (sectionNavigation == 0 || umbraco.library.GetPreValueAsString(sectionNavigation).ToUpperInvariant() != "BULLETED LIST");

            return(model);
        }
コード例 #3
0
        private async static Task <GuideStepViewModel> MapUmbracoContentToGuideStepViewModel(IPublishedContent content, IEastSussexGovUKTemplateRequest templateRequest)
        {
            var mediaUrlTransformer = new RemoveMediaDomainUrlTransformer();
            var viewModel           = new GuideStepViewModelFromUmbraco(content,
                                                                        new RelatedLinksService(mediaUrlTransformer, new RemoveAzureDomainUrlTransformer()),
                                                                        mediaUrlTransformer
                                                                        ).BuildModel();

            // Add common properties to the model
            var modelBuilder = new BaseViewModelBuilder(templateRequest);
            await modelBuilder.PopulateBaseViewModel(viewModel, content, new ContentExperimentSettingsService(),
                                                     new ExpiryDateFromExamine(content.Id, ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"], new ExpiryDateMemoryCache(TimeSpan.FromHours(1))).ExpiryDate,
                                                     UmbracoContext.Current.InPreviewMode, new SkinFromUmbraco());

            modelBuilder.PopulateBaseViewModelWithInheritedContent(viewModel,
                                                                   new UmbracoLatestService(content),
                                                                   new UmbracoSocialMediaService(content),
                                                                   new UmbracoEastSussex1SpaceService(content),
                                                                   new UmbracoEscisService(content));

            return(viewModel);
        }
コード例 #4
0
 public HomeController(IConfiguration configuration, IEastSussexGovUKTemplateRequest templateRequest, IViewModelDefaultValuesProvider defaultModelValues)
 {
     _configuration      = configuration;
     _templateRequest    = templateRequest;
     _defaultModelValues = defaultModelValues;
 }
コード例 #5
0
 public BaseViewModelBuilder(IEastSussexGovUKTemplateRequest templateRequest)
 {
     _templateRequest = templateRequest;
 }