コード例 #1
0
        public async Task <ActionResult <Image> > GetImage(int id)
        {
            var cashedImage = await cashService.GetCashResponseAsync(CashUtilities.GenerateKeyCashKeyFromRequest(this.Request));

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

            var image = await imagesService.GetImage(id);

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

            await cashService.CashResponseAsync(
                CashUtilities.GenerateKeyCashKeyFromRequest(this.Request),
                Image.ToViewModel(image),
                timeTolive);

            return(Ok(Image.ToViewModel(image)));
        }