Exemple #1
0
        public async Task <IActionResult> GetImageById([FromRoute][ValidateGuid] string imageId)
        {
            var image = await _imagesService.GetByIdAsync(imageId);

            if (image == null)
            {
                var error = new ApiError("Image with such Id was not found.", HttpStatusCode.NotFound);
                return(NotFound(error));
            }

            return(Ok(image));
        }
Exemple #2
0
        public async Task <ActionResult <ImageDto> > Get([FromRoute] int id)
        {
            var response = await _imagesService.GetByIdAsync(id);

            return(Ok(response));
        }