public ActionResult PostNewComment(SingleBlogPostVM model) { var ops = OperationsFactory.CreateCommentOps(); model.NewComment.DateOfComment = DateTime.Now; model.NewComment.Status = new Status() { StatusID = 1 }; ops.CreateComment(model.NewComment); return RedirectToAction("ShowSinglePost", new {id=model.NewComment.BlogPostID}); }
public ActionResult ShowSinglePost(int id) { var ops = OperationsFactory.CreateBlogPostOps(); var commentOps = OperationsFactory.CreateCommentOps(); var categoryOps = OperationsFactory.CreateCategoryOps(); var hashOps = OperationsFactory.CreateHashtagOps(); var singlePostVM = new SingleBlogPostVM() { NewComment = new Comment() }; singlePostVM.SelectedBlogPost = ops.GetBlogPostById(id); singlePostVM.Comments = commentOps.GetAllCommentsByBlogPostID(id).FindAll(x=>x.Status.StatusID == 2); singlePostVM.CategoriesForPost = categoryOps.ListAllCategoriesForBlogPost(id); singlePostVM.HashtagsForPost = hashOps.ListAllHashtagsForBlogPost(id); return View(singlePostVM); }