public void Handle(UpdateAnnotationCommand message) { if (!AnnotationExisting(message.AggregateId, message.MessageType)) { return; } var history = new AnnotationHistory(message.Title, message.Description, message.AggregateId); if (!AnnotationValid(history)) { return; } _annotationRepository.AddHistory(history); if (Commit()) { _bus.RaiseEvent(new AnnotationUpdatedEvent(message.Title, message.Description, message.AggregateId)); } }
public Task <Unit> Handle(UpdateAnnotationCommand request, CancellationToken cancellationToken) { if (!AnnotationExisting(request.AggregateId, request.MessageType)) { return(Unit.Task); } var history = new AnnotationHistory(request.Title, request.Description, request.AggregateId); if (!AnnotationValid(history)) { return(Unit.Task); } _annotationRepository.AddHistory(history); if (Commit()) { _mediator.RaiseEvent(new AnnotationUpdatedEvent(request.Title, request.Description, request.AggregateId)); } return(Unit.Task); }