public void ListPosts_ShouldReturnPosts()
        {
            var posts = butterClient.ListPosts();

            Assert.IsNotNull(posts);
            CollectionAssert.IsNotEmpty(posts.Data);
        }
Example #2
0
        public IActionResult Index()
        {
            ViewBag.BlogTitle = _appSettings.HeaderBlogTitle;
            ViewBag.AboutTheSiteDescription = _localizer["AboutTheSiteContent"];

            var dataResponse = _cmsClient?.ListPosts(int.MinValue, int.MaxValue, true, null, null, null);

            return(View(dataResponse?.Data?.OrderByDescending(x => x.Published).ToList()));
        }
Example #3
0
        // GET: Blog
        public ActionResult Index()
        {
            var apiToken = "ad9a837614a23d7c5222ba52bf3ed68bf8e5aa85";
            var client   = new ButterCMSClient(apiToken);

            List <ButterCMS.Models.Post> response = client.ListPosts(1, 10).Data.ToList();

            return(View(response));
        }
Example #4
0
        public IActionResult Index()
        {
            var           client    = new ButterCMSClient(apiToken);
            PostsResponse responses = client.ListPosts(1, 10);
            List <Post>   posts     = new List <Post>();

            foreach (Post postResp in responses.Data)
            {
                posts.Add(postResp);
            }
            ViewData["allPosts"] = posts;
            return(View());
        }