Beispiel #1
0
 public ActionResult Post(int pid)
 {
     var db = new BlogDb(@"Data Source=.\sqlexpress;Initial Catalog=Blog;Integrated Security=True");
     var post = db.GetPostById(pid);
     var comments = db.GetCommentsForPost(pid);
     var vm = new BlogPostViewModel { Post = post, Comments = comments };
     return View(vm);
 }
Beispiel #2
0
 public ActionResult Post(int postId)
 {
     var db = new BlogDb(_connectionString);
     var vm = new BlogSingleViewModel();
     vm.Post = db.GetPostById(postId);
     vm.Comments = db.GetCommentsForPost(postId);
     vm.Tags = db.GetTagsForPost(postId);
     return View(vm);
 }