public async Task <IActionResult> UpdateUser(int id, UserforUpdateDto user) { if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var userFromRepo = await _repo.GetUser(id); _mapper.Map <UserforUpdateDto, User>(user); if (await _repo.SaveAll()) { return(NoContent()); } throw new Exception($"Updating user {id} failed on save"); }
public async Task <IActionResult> UpdateUser(int id, UserforUpdateDto updateDto) { if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var user = await _datingAppService.GetUser(id); _mapper.Map(updateDto, user); if (await _datingAppService.SaveAll()) { return(NoContent()); } throw new Exception("updating faild,,"); }