public dynamic UpdateAddressClient([FromBody] ClientShippingAddressRequestDto clientShippingAddressRequestDto) { try { var result = _clientAppService.UpdateAccountWithAddress(clientShippingAddressRequestDto); return(Ok(result)); } catch (Exception ex) { //TODO: remover o OK return(BadRequest($"ERROR \n {ex.Message} \n {ex.StackTrace}")); } }
public bool UpdateAccountWithAddress(ClientShippingAddressRequestDto clientShippingAddressRequestDto) { IdentityResult result = null; var user = _userManager.GetUserAsync(_claimsPrincipal).Result; var jsonAddress = JsonConvert.SerializeObject(clientShippingAddressRequestDto); result = _userManager.AddClaimsAsync(user, new Claim[] { new Claim(JwtClaimTypes.PhoneNumber, clientShippingAddressRequestDto.Phone), new Claim(JwtClaimTypes.Address, jsonAddress, IdentityServer4.IdentityServerConstants.ClaimValueTypes.Json), }).Result; return(result != null && result.Succeeded); }