public async Task <ActionResult> UpdateUser(MemberupdateDTO updateDto) { var username = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var user = await _userRepositary.GetUserByNameAsync(username); _mapper.Map(updateDto, user); _userRepositary.Update(user); if (await _userRepositary.SaveAllAsync()) { return(NoContent()); } return(BadRequest("Failed to update the user")); }
public async Task <ActionResult> Patch([FromRoute] string email, UserPatchDTO userPatch) { var storedUser = await _userRepositary.FindByEmail(email); if (storedUser == null) { return(NotFound()); } if (!await UserCanAccessProfile(storedUser)) { return(Forbid()); } _mapper.Map(userPatch, storedUser); await _userRepositary.Update(storedUser); return(NoContent()); }