public async Task <ActionResult> ShowCaseStudy(string slug)

        {
            var butterClient = new ButterCMSClient("YOUR KEY");

            PageResponse <Page> caseStudy = await butterClient.RetrievePageAsync <Page>("*", slug);

            var viewModel = new PageViewModel();

            viewModel.Readme      = caseStudy.Data.Fields.readme;
            viewModel.Seo         = caseStudy.Data.Fields.seo;
            viewModel.twitterCard = caseStudy.Data.Fields.twitter_card;
            viewModel.openGraph   = caseStudy.Data.Fields.open_graph;


            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> ShowPage(string slug)
        {
            ViewBag.BlogTitle = _appSettings.HeaderBlogTitle;

            if (string.IsNullOrEmpty(slug))
            {
                return(View(CommonConstants.Views.ContentPage));
            }

            if (string.IsNullOrEmpty(_appSettings.ContentPageName))
            {
                return(View(CommonConstants.Views.ContentPage));
            }

            var parameterDict = new Dictionary <string, string>();
            var pageResponse  = await _cmsClient?.RetrievePageAsync <ContentPage>(_appSettings.ContentPageName, slug, parameterDict);

            return(View(CommonConstants.Views.ContentPage, pageResponse?.Data));
        }
        public async Task RetrievePageAsync_ShouldReturnPage()
        {
            var response = await butterClient.RetrievePageAsync <things>("things", "thingsthingsthings");

            Assert.IsNotNull(response);
        }