public void Publish() { if (_published) { throw new PostAlreadyPublishedException(); } var publishTime = DateTime.Now; var publishEvent = new PostPublishedEvent(publishTime, AggregateId); Apply(publishEvent); }
public override void When() { _postPublihsedEvent = new PostPublishedEvent(DateTime.Now, _postId); PostView.Handle(_postPublihsedEvent); }
private void PostPublished(PostPublishedEvent postPublishedEventPublishedEvent) { _publishTime = postPublishedEventPublishedEvent.PublishTime; _published = true; }