示例#1
0
        public async Task <ActionResult <Image> > GetproductImages(int productId)
        {
            var cashedImages = await cashService.GetCashCollectionResponseAsync(CashUtilities.GenerateKeyCashKeyFromRequest(this.Request));

            if (cashedImages != null)
            {
                return(Ok(cashedImages));
            }

            var images = await imagesService.GetproductImages(productId);

            if (images == null)
            {
                return(NotFound());
            }

            await cashService.CashResponseAsync(
                CashUtilities.GenerateKeyCashKeyFromRequest(this.Request),
                images.Select(x => Image.ToViewModel(x)),
                timeTolive);

            return(Ok(images.Select(x => Image.ToViewModel(x))));
        }