Exemple #1
0
        public async Task <IActionResult> GetImage(string id)
        {
            var image = await _imageService.GetImage(id);

            await AddInformationToImage(image);

            return(Ok(image));
        }
Exemple #2
0
        public IActionResult GetImage(string name)
        {
            FileStream fileStream = imagesService.GetImage(name);

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

            return(File(fileStream, "image/png"));
        }
        public async Task <ActionResult <ImageDTO> > GetImage(int id)
        {
            var image = await imagesService.GetImage(id);

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


            return(Ok(mapper.Map <ImageDTO>(image)));
        }
        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)));
        }