Example #1
0
        public async Task <IActionResult> AddPhotoUser(int userId, [FromForm] PhotoForCreationDto photoForCreationDto)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var photo = await _photoManager.AddPhotoUser(userId, photoForCreationDto);

            if (photo != null)
            {
                return(CreatedAtRoute("GetPhoto", new { id = photo.PublicId }, photo));
            }

            return(BadRequest("Could not add the photo"));
        }