public static WithUserInRoles ( this roleProvider, string userName ) : string[] | ||
roleProvider | this | |
userName | string | |
return | string[] |
public static string[] WithUserInRoles(this RoleProvider roleProvider, string userName, params string[] roles)
{
roles.ToList().ForEach(
x =>
{
if (!roleProvider.RoleExists(x))
{
roleProvider.CreateRole(x);
}
roleProvider.AddUsersToRoles(new[] { userName }, new[] { x });
});
return roles;
}