public void SeedAdmin(ChallengeAcceptedDbContext context) { var userManager = new UserManager<User>(new UserStore<User>(context)); var admin = new User() { Email = AdminEmail, UserName = "******", FirstName = "Adi", LastName = "Minkov" }; userManager.Create(admin, "123456"); userManager.AddToRole(admin.Id, GlobalConstants.AdminRole); context.SaveChanges(); }
public void SeedUsers(ChallengeAcceptedDbContext context) { var userManager = new UserManager<User>(new UserStore<User>(context)); var emails = new List<string> { string.Format("{0}@{1}.com", "pesho", "abv"), string.Format("{0}@{1}.com", "mariq", "abv"), string.Format("{0}@{1}.com", "gosho", "yahoo"), string.Format("{0}@{1}.com", "pepa", "gmail"), }; foreach (string email in emails) { var user = new User { Email = email, UserName = email.Split('@')[0], }; userManager.Create(user, "123456"); } context.SaveChanges(); }