コード例 #1
0
        /// <summary>
        /// Delete a post vote
        /// </summary>
        /// <param name="postVote">Post vote</param>
        public virtual void DeletePostVote(ForumPostVote postVote)
        {
            if (postVote == null)
                throw new ArgumentNullException("postVote");

            _forumPostVoteRepository.Delete(postVote);

            // update post
            var post = this.GetPostById(postVote.ForumPostId);
            post.VoteCount = postVote.IsUp ? --post.VoteCount : ++post.VoteCount;
            this.UpdatePost(post);

            //event notification
            _eventPublisher.EntityDeleted(postVote);
        }
コード例 #2
0
        /// <summary>
        /// Update a post vote
        /// </summary>
        /// <param name="postVote">Post vote</param>
        public virtual void UpdatePostVote(ForumPostVote postVote)
        {
            if (postVote == null)
                throw new ArgumentNullException("postVote");

            _forumPostVoteRepository.Update(postVote);

            //event notification
            _eventPublisher.EntityUpdated(postVote);
        }