Ejemplo n.º 1
0
 public async Task <GetDigitalAssetByIdResponse> Handle(GetDigitalAssetByIdRequest request)
 {
     return(new GetDigitalAssetByIdResponse()
     {
         DigitalAsset = DigitalAssetApiModel.FromDigitalAsset(await _context.DigitalAssets.FindAsync(request.Id))
     });
 }
Ejemplo n.º 2
0
 public async Task <GetDigitalAssetByUniqueIdResponse> Handle(GetDigitalAssetByUniqueIdRequest request)
 {
     return(new GetDigitalAssetByUniqueIdResponse()
     {
         DigitalAsset = DigitalAssetApiModel.FromDigitalAsset(await _context.DigitalAssets.SingleAsync(x => x.UniqueId.ToString() == request.UniqueId))
     });
 }
            public async Task <GetDigitalAssetsResponse> Handle(GetDigitalAssetsRequest request)
            {
                var digitalAssets = await _cache.FromCacheOrServiceAsync <List <DigitalAsset> >(() => _context.DigitalAssets.ToListAsync(), DigitalAssetCacheKeys.DigitalAssets);

                return(new GetDigitalAssetsResponse()
                {
                    DigitalAssets = digitalAssets.Select(x => DigitalAssetApiModel.FromDigitalAsset(x)).ToList()
                });
            }