Esempio n. 1
0
        protected void When(CommentCreatedDomainEvent commentCreatedDomainEvent)
        {
            comments = comments ?? new List <Comment>();
            Comment comment = new Comment(commentCreatedDomainEvent.Message);

            comments.Add(comment);
        }
Esempio n. 2
0
        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));
        }