コード例 #1
0
        // GET: Admin/BlogManagement
        public ActionResult Index()
        {
            ShowBlogViewModel model = new ShowBlogViewModel();

            model.PostList = _postsManagement.GetAll().OrderByDescending(p => p.CreatedAt).ToList();

            return(View(model));
        }
コード例 #2
0
 /// <summary>
 /// Routes to a dynamically generated "Blog Show" Page. Gathers information from the database.
 /// </summary>
 /// <param name="id">Id of the Blog</param>
 /// <returns>A dynamic "Blog Show" webpage which provides detailes for a selected blog.</returns>
 /// <example>GET : /Blog/Show/5</example>
 public ActionResult Show(int id)
 {
     ShowBlogViewModel ViewModel = new ShowBlogViewModel();
     string url = "blogapi/findblog/" + id;
     HttpResponseMessage response = client.GetAsync(url).Result;
     if (response.IsSuccessStatusCode)
     {
         BlogDto SelectedBlogs = response.Content.ReadAsAsync<BlogDto>().Result;
         ViewModel.Blog = SelectedBlogs;
         return View(ViewModel);
     }
     else
     {
         return RedirectToAction("Error");
     }
 }