Example #1
0
        public async Task <ActionResult> ShowPost(string slug)
        {
            var response = await _client.RetrievePostAsync(slug);

            ViewBag.Post = response.Data;
            return(View("Post"));
        }
Example #2
0
        public async Task <ActionResult> ShowPost(string slug)
        {
            ViewBag.BlogTitle = _appSettings.HeaderBlogTitle;

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

            var postResponse = await _cmsClient?.RetrievePostAsync(slug);

            return(View(CommonConstants.Views.Post, postResponse));
        }
        public async Task <IActionResult> OnGet(string slug)
        {
            if (string.IsNullOrEmpty(slug) || string.IsNullOrWhiteSpace(slug))
            {
                RedirectToPage("/");
            }

            PostResponse post = await _client.RetrievePostAsync(slug);

            Post = post.Data;

            if (Post == null)
            {
                return(NotFound());
            }

            return(Page());
        }
Example #4
0
        public async Task RetrievePostAsync_ShouldReturnPost()
        {
            var post = await butterClient.RetrievePostAsync("this-is-a-blog-post");

            Assert.IsNotNull(post);
        }