I created a new MVC application in the new VS2013 IDE. I added the following to the Login Action on the AccountController as I wanted to create a default user dynamically:
var admin = new ApplicationUser() { UserName = "administrator" };
var result = UserManager.Create(admin, "administrator");
This works great, I then wanted to put this default user into a new default role:
user = UserManager.FindByName("administrator");
var roleresult = UserManager.AddToRole(user.Id,"admin");
The second line errors because obviously it can't find the role "admin" as it doesn't exist yet, but I can't find a relevant method on the UserManager to do so. Where can I find the method to add roles dynamically?