예제 #1
0
        [HttpGet("api/image/{id}.jpg")] //jpg extension is used so files can be cached by CDNs and browsers
        public async Task <ActionResult> Retrieve(string id)
        {
            var model = new ImageModel();
            var bytes = await model.FetchAsync(id);

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

            return(File(bytes, "image/jpeg"));
        }