How can I convert this:
RoleManager roleManager = new RoleManager(new RoleStore(new IdentityDbContext()));
UserManager userManager = new UserManager(new UserStore(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
Ravi PatelPosted Nov 5, 2015, 1:00 AM
@Html.DropDownList("selectedRoleId", (SelectList)ViewBag.RoleName)
in Controller
[HttpPost]
public ActionResult Action(string selectedRoleId)
{
// if you want role name then you can fetch from database with the help of selectedRoleId
return View();
}
Mikulas LuckanicPosted Nov 4, 2015, 3:19 PM
Amit ChoudharyPosted Nov 4, 2015, 3:16 PM
Mikulas LuckanicPosted Nov 4, 2015, 2:34 PM
Amit ChoudharyPosted Nov 4, 2015, 2:04 PM