Ejemplo n.º 1
0
        public void ApproveComment(Guid commentId)
        {
            var @event = new CommentApproved(commentId);

            Apply(@event);

            AppendEvent(@event);
        }
Ejemplo n.º 2
0
        public void Handle(CommentApproved @event)
        {
            var collection = CreateCollection();

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

            collection.Remove(find, RemoveFlags.Single);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        public void Apply(CommentApproved @event)
        {
            var comment = _comments.First(x => x.Id == @event.CommentId);

            comment.Approved = true;
        }
Ejemplo n.º 5
0
        public void ApproveComment(Guid commentId)
        {
            var @event = new CommentApproved(commentId);

            Apply(@event);

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

            comment.Approved = true;
        }