protected virtual void LoadComments(CommentItem addedComment) { // Comments enabled and exist? if (CurrentEntry.DisableComments.Checked || ManagerFactory.CommentManagerInstance.GetCommentsCount() == 0) { if (CommentList != null) { CommentList.Visible = false; } } else { if (ListViewComments != null) { CommentItem[] comments = ManagerFactory.CommentManagerInstance.GetEntryComments(); //if a comment has been added but is not coming back yet (i.e. being indexed), fake it if (addedComment != null && comments.Count(comment => comment.ID == addedComment.ID) == 0) { List <CommentItem> newList = new List <CommentItem>(); newList.Add(addedComment); newList.AddRange(comments); comments = newList.ToArray(); } ListViewComments.DataSource = comments; ListViewComments.DataBind(); } } }
protected virtual void LoadComments(CommentItem addedComment = null) { // Comments enabled and exist? var showCommentsList = CurrentBlog.EnableComments.Checked && !CurrentEntry.DisableComments.Checked; if (!showCommentsList || ManagerFactory.CommentManagerInstance.GetCommentsCount(CurrentEntry) == 0) { if (CommentList != null) { CommentList.Visible = false; } } else { if (ListViewComments != null) { ListViewComments.DataSource = CommentsListCore.LoadComments(addedComment); ListViewComments.DataBind(); } } }