protected override async Task <Result> HandleEx(UpdateDocumentCommand command, CancellationToken cancellationToken = default) { var doc = new DocumentFactory(Bus.User.Id, _clock.Now).CreateFromCommand(command); doc.Validate("Error updating document"); var massTransitCommand = await new CommandFactory().CreateUpdateDocumentCommand(doc, _messageDataRepository); await _massTransitBus.Send(massTransitCommand, cancellationToken).ConfigureAwait(false); return(Result.Success()); }
protected override async Task <Result> HandleEx(DeleteDocumentCommand command, CancellationToken cancellationToken = default) { var doc = new DocumentFactory(Bus.User.Id).CreateFromCommand(command); doc.Validate("Error deleting document"); var massTransitCommand = new CommandFactory().CreateDeleteDocumentCommand(doc); await _massTransitBus.Send(massTransitCommand, cancellationToken).ConfigureAwait(false); return(Result.Success()); }