public ActionResult CommentAddEdit(PostCommentModel model) { PostComment comment = model.Comment; if (ModelState.IsValid) { PostComment model2 = PostComment.GetContentCommentByID(comment.ContentCommentID); model2.CommenterEmail = comment.CommenterEmail; model2.CommenterName = comment.CommenterName; model2.CommenterURL = comment.CommenterURL ?? String.Empty; model2.IsApproved = comment.IsApproved; model2.IsSpam = comment.IsSpam; model2.PostCommentText = comment.PostCommentText ?? String.Empty; model2.Save(); if (model.ViewMode == PostCommentModel.ViewType.PageView) { return RedirectToAction("CommentAddEdit", new { @id = comment.ContentCommentID, @pageComment = true }); } return RedirectToAction("CommentAddEdit", new { @id = comment.ContentCommentID }); } Helper.HandleErrorDict(ModelState); return View(model); }
public ActionResult DeleteCommentAddEdit(PostCommentModel model) { ModelState.Clear(); var model2 = PostComment.GetContentCommentByID(model.Comment.ContentCommentID); model2.Delete(); if (model.ViewMode == PostCommentModel.ViewType.PageView) { if (model.Comment.ContentType == ContentPageType.PageType.BlogEntry) { return RedirectToAction("BlogPostCommentIndex", new { @id = model.Root_ContentID }); } else { return RedirectToAction("PageCommentIndex", new { @id = model.Root_ContentID }); } } if (model.Comment.ContentType == ContentPageType.PageType.BlogEntry) { return RedirectToAction("BlogPostCommentIndex"); } else { return RedirectToAction("PageCommentIndex"); } }
public ActionResult CommentAddEdit(Guid id, bool? pageComment) { PostComment model1 = PostComment.GetContentCommentByID(id); PostCommentModel model = null; if (pageComment.HasValue && pageComment.Value) { model = new PostCommentModel(model1, PostCommentModel.ViewType.PageView); } else { if (model1.ContentType == ContentPageType.PageType.BlogEntry) { model = new PostCommentModel(model1, PostCommentModel.ViewType.BlogIndex); } else { model = new PostCommentModel(model1, PostCommentModel.ViewType.ContentIndex); } } return View(model); }