public async Task <IActionResult> PostUploadAvatar(IFormFile image) { if (!_imageUploadService.IsValid(image)) { return(BadRequest(ImageUploadService.INVALID_MESSAGE)); } var uriPath = await _imageUploadService.SaveAvatar(image, CurrentUserId); return(Ok(new { uriPath })); }
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 })); }