private async Task <AssetDto> InvokeCommandAsync(ICommand command) { var context = await CommandBus.PublishAsync(command); if (context.PlainResult is AssetDuplicate created) { return(AssetDto.FromDomain(created.Asset, Resources, true)); } else { return(AssetDto.FromDomain(context.Result <IEnrichedAssetEntity>(), Resources)); } }
public async Task <IActionResult> GetAsset(string app, DomainId id) { var asset = await assetQuery.FindAsync(Context, id, ct : HttpContext.RequestAborted); if (asset == null) { return(NotFound()); } var response = Deferred.Response(() => { return(AssetDto.FromDomain(asset, Resources)); }); return(Ok(response)); }