public ActionResult Detail(Guid id) { var post = DataAccessLayer.GetById<BlogPost>(id); if (post == null) { return HttpNotFound("Post not found"); } var binder = new BlogToBlogPost(DataAccessLayer); var entry = new Blog.Entry(); binder.InverseLoad(post, entry); return View(entry); }
public ActionResult TopPosts() { //var listOfPosts = DataAccessLayer.TopRandom<BlogPost>(BlogsCount); var listOfPosts = DataAccessLayer.Get<BlogPost>().Take(BlogsCount); if (listOfPosts == null) { return HttpNotFound("Posts not found"); } var blog = new Blog {Posts = new List<Blog.Entry>()}; foreach (var blogPost in listOfPosts) { var binder = new BlogToBlogPost(DataAccessLayer); var entry = new Blog.Entry(); binder.InverseLoad(blogPost, entry); blog.Posts.Add(entry); } return PartialView(blog); }