public ActionResult UpdateComment(string commentId, CommentStatus status = CommentStatus.Disable) { var pageCommentStore = CommentHelper.GetCommentStoreName(); var id = EPiServer.Data.Identity.NewIdentity(new Guid(commentId)); var comment = CommentHelper.GetCommentById(pageCommentStore, id); if (comment != null) { if (status == CommentStatus.Enable || status == CommentStatus.Disable) { comment.IsDeleted = status == CommentStatus.Disable ? true : false; CommentHelper.UpdateComment(pageCommentStore, comment); } else { CommentHelper.Delete(pageCommentStore, id); } } else { return(Json(new { status = "error", message = "Not found" }, JsonRequestBehavior.AllowGet)); } return(Json(new { status = "ok", pageId = comment.PageId }, JsonRequestBehavior.AllowGet)); }
public ActionResult LoadComment(int pageId = 0, CommentStatus status = CommentStatus.Enable) { var pageCommentStore = CommentHelper.GetCommentStoreName(); var condition = CreateCondition(pageId, status); var listComment = CommentHelper.GetCommentByPageCondition(condition); return(PartialView("_ListComment", listComment)); }
public ActionResult PostComment(UserCommentViewModel comment) { var commentStore = CommentHelper.GetCommentStoreName(); var currentUrl = HttpContext.Request.UrlReferrer.AbsoluteUri; var store = DynamicDataStoreFactory.Instance.CreateStore(commentStore, typeof(UserCommentViewModel)); comment.CreatedDate = DateTime.Now; store.Save(comment); return(Redirect(currentUrl)); }
public ActionResult Index() { var listPages = PageHelper.FilterPagesByExistedProperty(GetChildrenPageOfStartPage(), PageProperty.UserComment); var selectedPage = listPages.FirstOrDefault(); var pageCommentStore = CommentHelper.GetCommentStoreName(); var selectedPageId = selectedPage != null ? selectedPage.ContentLink.ID : 0; var condition = CreateCondition(selectedPageId, CommentStatus.Enable); var model = new PluginCommentViewModel { }; model.SelectedPagedId = selectedPageId; model.ListComment = CommentHelper.GetCommentByPageCondition(condition); model.ListPages = listPages; //add jquery-js lib RequireClientResources(); return(View(model)); }