Beispiel #1
0
        public async Task <ActionResult <string> > PostUploadImage(long placeId, int imageId, IFormFile image)
        {
            if (imageId < 1 || imageId > 3)
            {
                return(BadRequest("You can only upload 3 images per place."));
            }

            if (!IsAuthorized(placeId))
            {
                return(Unauthorized());
            }

            if (!_imageUploadService.IsValid(image))
            {
                return(BadRequest(ImageUploadService.INVALID_MESSAGE));
            }

            var uriPath = await _imageUploadService.SavePlaceImage(image, placeId, imageId);

            return(Ok(new { uriPath }));
        }