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 singlePostVM = new SingleBlogPostVM() { NewComment = new Comment() }; singlePostVM.SelectedBlogPost = ops.GetBlogPostById(id); singlePostVM.Comments = commentOps.GetAllCommentsByBlogPostID(id).FindAll(x => x.Status.StatusID == 2); return(View(singlePostVM)); }