In MVC4 I was using the code
Roles.AddUserToRole(User.Identity.Name, \"Approved\");
Is there any other way of doing the same(adding user to
You can call AddToRole or AddToRoleAsync as an instance method on any object of type UserManager to achieve it in MVC 5, like below:
var _context = new ApplicationDbContext();
var UserManager = new UserManager(new UserStore(_context));
UserManager.AddToRole("UserName", "UserRole");
For more details, take a look at the following link:
http://msdn.microsoft.com/en-us/library/dn468199(v=vs.111).aspx
http://blogs.msdn.com/b/webdev/archive/2013/10/20/building-a-simple-todo-application-with-asp-net-identity-and-associating-users-with-todoes.aspx