示例#1
0
        public void ApproveComment(Guid commentId)
        {
            var @event = new CommentApproved(commentId);

            Apply(@event);

            AppendEvent(@event);
        }
示例#2
0
        public void Handle(CommentApproved @event)
        {
            var collection = CreateCollection();

            var find = Query.EQ("_id", @event.CommentId);

            collection.Remove(find, RemoveFlags.Single);
        }
示例#3
0
        public void Handle(CommentApproved @event)
        {
            var collection = CreateCollection();

            var postsRepository = new PostsRepository(_mongoDatabase);

            var post = postsRepository.Find(@event.AggregateRootId);

            var comment = post.Comments.First(x => x.Id == @event.CommentId);

            var find = Query.EQ("_id", @event.AggregateRootId);

            var update = Update.AddToSet("Comments", comment.ToBsonDocument());

            collection.Update(find, update);
        }
示例#4
0
        public void Apply(CommentApproved @event)
        {
            var comment = _comments.First(x => x.Id == @event.CommentId);

            comment.Approved = true;
        }
示例#5
0
        public void ApproveComment(Guid commentId)
        {
            var @event = new CommentApproved(commentId);

            Apply(@event);

            AppendEvent(@event);
        }
示例#6
0
        public void Apply(CommentApproved @event)
        {
            var comment = _comments.First(x => x.Id == @event.CommentId);

            comment.Approved = true;
        }