EDIT
Identity
In Identity RoleManager is for creating roles, and UserManager is for adding users to roles. This is an example that points you in the right direction. Below is the code to create a new Administrator role
if (!roleManager.RoleExists("Administrator")) { MyIdentityRole newRole = new MyIdentityRole("Administrator", "Administrators can do something with data"); roleManager.Create(newRole); }
EDIT
Also, this is for adding a user to a role, and this is also an example:
\\assuming you test if the user has been assigned to the role "Administrator" before adding them to that role if(RoleAdministrator == true){ userManager.AddToRole(User.Id, "Administrator"); }
jamiedanq
source share