I have problem with Identity 2.0 . I'm trying to update claim on a user. So here is my code.
var UserID = User.Identity.GetUserId();
var claims = await UserManager.GetClaimsAsync(UserID);
var displayName = claims.FirstOrDefault(i => i.Type == "DisplayName");
var isPublic = claims.FirstOrDefault(i => i.Type == "IsPublic");
if (displayName != null)
await UserManager.RemoveClaimAsync(UserID, displayName);
if (isPublic != null)
await UserManager.RemoveClaimAsync(UserID, isPublic);
await UserManager.AddClaimAsync(UserID, nClaim("DisplayName", model.DisplayName));
await UserManager.AddClaimAsync(UserID, nClaim("IsPublic", model.IsPublic.ToString()));
http://prntscr.com/6azxr5 this is what I get. Does anyone have a clue ?
Thanks.