예제 #1
0
파일: Program.cs 프로젝트: brgoza/BandAide2
        public static CommandResponse SeedUsers(int count)
        {
            var newUsers = new Seeder().GetSeedUserData(count);

            newUsers.ForEach(x => x.UserName = x.Email);
            newUsers.ForEach(x => Console.Write(x.UserName + ", "));

            var userStore = new UserStore<User>(Db);
            var userManager = new UserManager<User>(userStore);

            foreach (
                var newUser in newUsers.Where(newUser => !Db.Users.Any(x => x.UserName == newUser.UserName)))
            {
                userManager.Create(newUser, "Password@123");
            }
            return CommandResponse.Success;
        }
예제 #2
0
파일: Program.cs 프로젝트: brgoza/BandAide2
 public static CommandResponse SeedBands(int count)
 {
     Console.WriteLine($"Seeding {count} bands...");
     var bandNames = new Seeder().GetSeedBandNames(count);
     bandNames.ForEach(x => Db.Bands.Add(new Band { Name = x }));
     Db.SaveChanges();
     return CommandResponse.Success;
 }