/// <summary> /// Ges the commentt view. /// </summary> /// <param name="commentAction">The comment action.</param> /// <param name="getCommentsMethod">The get comments method.</param> /// <param name="cp">The cp.</param> /// <param name="view">The view.</param> /// <returns></returns> private ManageCommentsView GeCommentView(CommentAction commentAction, Func <List <Comment> > getCommentsMethod, string cp, string view) { string message; if (commentAction.CommentActionType != "-1") { if (commentAction.CommentId != null && commentAction.CommentId.Length > 0) { CommentStatus commentStatus = commentAction.CommentActionType.ParseEnum <CommentStatus>(); _commentRepository.UpdateCommentStatus(commentStatus, commentAction.CommentId, Owner.Id); message = string.Format("Selected comments have been changed to {0}.", commentAction.CommentActionType); } else { message = "Please select one or more comments."; } } else { message = "Please select an action."; } ManageCommentsView commentView = GetManageCommentView(getCommentsMethod, cp, view); commentView.UIMessage = message; return(commentView); }
/// <summary> /// Indexes the get. /// </summary> /// <param name="cp">The cp.</param> /// <returns></returns> private ActionResult IndexGet(string cp) { ManageCommentsView view = GetManageCommentView(() => _commentRepository.RetrieveCommentsByUserId(Owner.Id), cp, "all"); IDictionary <string, string> crumbs = GetBreadCrumbs("all"); return(View("Index", view, crumbs)); }
/// <summary> /// Gets the manage comment view. /// </summary> /// <param name="getCommentsMethod">The get comments method.</param> /// <param name="cp">The cp.</param> /// <param name="view">The view.</param> /// <returns></returns> private ManageCommentsView GetManageCommentView(Func <List <Comment> > getCommentsMethod, string cp, string view) { List <Comment> comments = getCommentsMethod(); // ManageCommentsView commentView = GetCommentView(comments, cp, view); return(commentView); }
public ActionResult Approved(CommentAction commentAction, string cp) { const string approved = "approved"; ManageCommentsView view = GetCommentView(_commentRepository.RetrieveCommentByStatusAndUserId(Owner.Id, CommentStatus.Approved), cp, approved); IDictionary <string, string> crumbs = GetBreadCrumbs(approved); return(View("Index", view, crumbs)); }
public ActionResult Spam(CommentAction commentAction, string cp) { const string breadCrumbName = "spam"; ManageCommentsView view = GetCommentView(_commentRepository.RetrieveCommentByStatusAndUserId(Owner.Id, CommentStatus.Spam), cp, breadCrumbName); IDictionary <string, string> crumbs = GetBreadCrumbs(breadCrumbName); return(View("Index", view, crumbs)); }
/// <summary> /// Indexes the post. /// </summary> /// <param name="commentAction">The comment action.</param> /// <param name="cp">The cp.</param> /// <returns></returns> private ActionResult IndexPost(CommentAction commentAction, string cp) { IDictionary <string, string> crumbs = GetBreadCrumbs("all"); ManageCommentsView view = GeCommentView(commentAction, () => _commentRepository.RetrieveCommentsByUserId(Owner.Id), cp, "all"); // ReSharper disable Asp.NotResolved return(View("Index", view, crumbs)); // ReSharper restore Asp.NotResolved }
public ActionResult Approved(string cp) { List <Comment> comments = _commentRepository.RetrieveCommentByStatusAndUserId(Owner.Id, CommentStatus.Approved); const string breadCrumbName = "approved"; IDictionary <string, string> crumbs = GetBreadCrumbs(breadCrumbName); ManageCommentsView view = GetCommentView(comments, cp, breadCrumbName); return(View("Index", view, crumbs)); }