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 })); }
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)); }