private async Task InitViewBag() { ViewBag.ConnectUrls = GetFederationManagementUrls(ViewBag.Claims, ManagementDisconnectedAccountType, "connect"); ViewBag.DisconnectUrls = GetFederationManagementUrls(ViewBag.Claims, ManagementConnectedAccountType, "disconnect"); var claims = await ProfileClient.GetClaims(User.Identity.GetUserId()); var profile = new UpdateProfileClaimsViewModel { Name = claims.FirstOrDefault(x => x.Type == Common.Consts.DefaultClaimNamespace + "name")?.Value ?? "", Address = claims.FirstOrDefault(x => x.Type == Common.Consts.DefaultClaimNamespace + "address")?.Value ?? "" }; ViewBag.Profile = profile; }
public async Task<ActionResult> UpdateProfileClaims(UpdateProfileClaimsViewModel model) { var userId = User.Identity.GetUserId(); await ProfileClient.AddOrUpdateClaims(userId, new List<Claim> { new Claim(Common.Consts.DefaultClaimNamespace + "name", model.Name), new Claim(Common.Consts.DefaultClaimNamespace + "address", model.Address) }); await RefreshClaims(userId); return RedirectToAction("Index"); }