async Task <IdentityResult> IRoleStore <TRole> .CreateAsync(TRole role, CancellationToken cancellationToken) { var found = _collection.FindByNameAsync(role.NormalizedName); if (found == null) { await _collection.CreateAsync(role); } return(IdentityResult.Success); }
public async Task <IList <string> > GetRolesAsync(TUser user, CancellationToken cancellationToken) { return((await _userCollection.FindByIdAsync(user.Id))?.Roles ?.Select(roleId => _roleCollection.FindByNameAsync(roleId).Result) .Where(x => x != null) .Select(x => x.Name) .ToList() ?? new List <string>()); }
public async Task <TRole> FindByNameAsync(string normalizedName) { return(await ExecuteWithLog(async() => await _Collection.FindByNameAsync(normalizedName))); }