Exemplo n.º 1
0
        public async Task <GetPreviewHubQueryResult> Handle(GetPreviewHubQuery request, CancellationToken cancellationToken)
        {
            var article = _client.Get <CmsContent>(new GetHubEntriesRequest(request.Hub.ToTitleCase()));
            var menu    = _mediator.RetrieveMenu(cancellationToken);
            var banners = _mediator.RetrieveBanners(cancellationToken: cancellationToken);

            await Task.WhenAll(article, menu, banners);

            var pageModel = new HubPageModel().Build(article.Result, menu.Result.MainContent, banners.Result);

            return(new GetPreviewHubQueryResult
            {
                PageModel = pageModel
            });
        }
        public async Task <GetPreviewLandingPageQueryResult> Handle(GetPreviewLandingPageQuery request, CancellationToken cancellationToken)
        {
            var landingPage = _client.Get <CmsContent>(new GetLandingPageRequest(request.Hub.ToTitleCase(), request.Slug));
            var menu        = _mediator.RetrieveMenu(cancellationToken);
            var banners     = _mediator.RetrieveBanners(cancellationToken: cancellationToken);


            await Task.WhenAll(landingPage, menu, banners);

            var pageModel = new LandingPageModel().Build(landingPage.Result, menu.Result.MainContent, banners.Result);

            return(new GetPreviewLandingPageQueryResult()
            {
                PageModel = pageModel
            });
        }