public async Task <bool> AddOrUpdateRoleClaim(SystemRole role, string claimType, string claimValue) { var claims = await _roleManager.GetClaimsAsync(role); var values = from claim in claims where claim.Type == claimType select claim; if (values.Count() > 0) { await _roleManager.RemoveClaimAsync(role, values.FirstOrDefault()); } var result = await _roleManager.AddClaimAsync(role, new Claim(type : claimType, value : claimValue)); return(result.Succeeded); }
public async Task <bool> AddRole(SystemRole role) { var result = await _roleManager.CreateAsync(role); return(result.Succeeded); }