Exemplo n.º 1
0
        public AjaxResponse AddComment(string parentCommentId, string pageName, string text, string pid)
        {
            text = HtmlUtility.GetFull(text);
            var resp = new AjaxResponse();

            resp.rs1 = parentCommentId;

            var parentIdGuid = String.IsNullOrEmpty(parentCommentId) ? Guid.Empty : new Guid(parentCommentId);
            var newComment   = Wiki.CreateComment(new Comment {
                Body = text, PageName = pageName, ParentId = parentIdGuid
            });

            var info = GetCommentInfo(newComment);

            var defComment = new CommentsList();

            ConfigureComments(defComment, pageName);

            var visibleCommentsCount = Wiki.GetComments(pageName).Count;

            resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer(
                defComment,
                info,
                string.IsNullOrEmpty(parentCommentId),
                visibleCommentsCount % 2 == 1);

            return(resp);
        }