protected void When(CommentCreatedDomainEvent commentCreatedDomainEvent) { comments = comments ?? new List <Comment>(); Comment comment = new Comment(commentCreatedDomainEvent.Message); comments.Add(comment); }
public void Comment(Comment comment) { if (enabled == false) { throw new DomainException("The blog is disabled. Enable this before making any changes."); } if (published == true) { throw new DomainException("The post is already hidden."); } Raise(CommentCreatedDomainEvent.Create(this, comment.Id, comment.Message)); }