Exemplo n.º 1
0
        public async Task <ActionResult <ImageDTO> > GetproductImages(int productId)
        {
            var images = await imagesService.GetproductImages(productId);

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


            return(Ok(images.Select(x => mapper.Map <ImageDTO>(x))));
        }
Exemplo n.º 2
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))));
        }