How to add role to user in default database created by mvc

Nov 4 2015 1:48 PM
How can I convert this: 
 
RoleManager<IdentityRole> roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new IdentityDbContext()));
UserManager<ApplicationUser> userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
roleManager.Create(new IdentityRole(RoleName));
ApplicationUser user = userManager.FindByEmail(UserName);
userManager.AddToRole(user.Id, RoleName);
 
to two dropdown lists and one button?
 
I want add role to user in default database. Thx 
 
asp.net 

Answers (5)