public async Task <IActionResult> UpdateUserDetails(int id, UpdateUserDetailsDTO updateUserDetailsDTO) { if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var user = await _repo.GetUser(id); _mapper.Map(updateUserDetailsDTO, user); user.Avatar = await _avatarRepo.GetAvatarByURL(updateUserDetailsDTO.avatarURL); if (await _repo.SaveAll()) { return(NoContent()); } throw new Exception($"Updating user {id} failed on save"); }