Example #1
0
        public HttpResponseMessage GetPost()
        {
            var recentPosts = BlogServices.GetPosts().Result;

            var tags = BlogServices.GetTags().Result;

            var model = new IndexModel
            {
                RecentPosts = recentPosts.ToList(),
                Tags        = tags.ToList()
            };

            return(Request.CreateResponse(HttpStatusCode.OK, new { Data = model, Status = HttpStatusCode.OK }));
        }
Example #2
0
        public async Task <ActionResult> Index()
        {
            var recentPosts = await BlogServices.GetPosts();

            var tags = await BlogServices.GetTags();

            var model = new IndexModel
            {
                RecentPosts = recentPosts,
                Tags        = tags
            };

            return(View(model));
        }