Пример #1
0
        /// <summary>
        /// Add RelatedComment to main Comment
        /// </summary>
        /// <param name="comment">The Comment</param>
        /// <param name="parent">The parent</param>
        /// <param name="user">The User who writes the Comment</param>
        public void AddRelatedComment(Comment comment, int parent, User user)
        {
            if (user != null)
            {
                comment.User = user;
            }
            if (comment.AnonymousUser == null)
            {
                comment.AnonymousUser = new AnonymousUser();
            }
            comment.isRelatedComment = true;
            CommentRepository.Insert(comment);
            Comment parentComment = CommentRepository.GetByID(parent);

            parentComment.AddRelatedComment(comment);
            CommentRepository.UnitOfWork.Commit();
        }