Esempio n. 1
0
        // Post
        public void Handle(AddPostCommand message)
        {
            var post = new Post(message.TopicId, message.UserId, message.Text);

            if (!post.IsValid())
            {
                NotifyErrors(post.ValidationResult);
                return;
            }

            _topicRepository.AddPost(post);
            if (Commit())
            {
                _bus.RaiseEvent(new AddedPostEvent(post.Id, post.UserId, post.TopicId, post.Text, post.Created));
            }
        }