public async Task <TRole> FindByIdAsync(string roleId, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(roleId)) { throw new ArgumentNullException(nameof(roleId)); } return(await roleTable.GetRoleId(roleId, cancellationToken)); }
public async Task AddToRoleAsync(TUser user, string roleName, CancellationToken cancellationToken) { if (user == null) { throw new ArgumentNullException("user"); } if (string.IsNullOrEmpty(roleName)) { throw new ArgumentException("Argument cannot be null or empty: roleName."); } var role = await roleTable.GetRoleId(roleName, cancellationToken); if (role != null) { await userRolesTable.Insert(user, role.Id, cancellationToken); } }