public void Handle(RegisterAnnotationCommand message) { var annotation = new Annotation(message.Title, message.Description); if (!AnnotationValid(annotation.AnnotationHistory.FirstOrDefault())) { return; } _annotationRepository.Add(annotation); if (Commit()) { _bus.RaiseEvent(new AnnotationRegistredEvent(annotation.Id)); } }
public Task <Unit> Handle(RegisterAnnotationCommand request, CancellationToken cancellationToken) { var annotation = new Annotation(request.Title, request.Description); if (!AnnotationValid(annotation.AnnotationHistory.FirstOrDefault())) { return(Unit.Task); } _annotationRepository.Add(annotation); if (Commit()) { _mediator.RaiseEvent(new AnnotationRegistredEvent(annotation.Id)); } return(Unit.Task); }