Exemplo n.º 1
0
        public async Task <ActionResult> AddUserPhoto(int userId, [FromForm] UserPhotoRequest userPhotoRequest)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                throw new RestException(HttpStatusCode.Forbidden);
            }

            var photoAdded = await _serv.AddUserPhoto(userId, userPhotoRequest);

            return(CreatedAtRoute("GetPhoto", new { id = photoAdded.Id, userId = userId }, photoAdded));
        }