コード例 #1
0
        private void SeedSeasons(BrorepDbContext context)
        {
            Seasons.Add(new Season {
                Name     = "Season zero", Start = DateTime.UtcNow.AddDays(-90), End = DateTime.UtcNow.AddDays(-1),
                Workouts = new List <Workout> {
                    new Workout {
                        Name = "Workout 1"
                    }
                }
            });
            Seasons.Add(new Season {
                Name     = "Season one", Start = DateTime.UtcNow, End = DateTime.UtcNow.AddDays(90),
                Workouts = new List <Workout> {
                    new Workout {
                        Name = "Workout 2"
                    }
                }
            });
            Seasons.Add(new Season {
                Name     = "Season two", Start = DateTime.UtcNow.AddDays(90), End = DateTime.UtcNow.AddDays(180),
                Workouts = new List <Workout> {
                    new Workout {
                        Name = "Workout 3"
                    }
                }
            });

            context.Seasons.AddRange(Seasons);
            context.SaveChanges();
        }
コード例 #2
0
        public static void Initialize(BrorepDbContext context, UserManager <ApplicationUser> userManager)
        {
            var initializer = new BrorepInitializer();

            _userManager = userManager;

            initializer.SeedEverything(context);
        }
コード例 #3
0
        private void SeedJudgingTypes(BrorepDbContext context)
        {
            JudgingTypes.Add(new JudgingType {
                Name = "10 Reps", Description = "Set of 10 repititions to judge"
            });

            context.AddRange(JudgingTypes);
            context.SaveChanges();
        }
コード例 #4
0
        public void SeedEverything(BrorepDbContext context)
        {
            if (context.Users.Any())
            {
                return; // Db has been seeded
            }

            SeedUsers(context);
            SeedSeasons(context);
            SeedJudgingTypes(context);
            SeedSubmissions(context);
            SeedGrades(context);
        }
コード例 #5
0
        private void SeedUsers(BrorepDbContext context)
        {
            Users.Add(new ApplicationUser {
                UserName = "******", PhoneNumber = "123"
            });
            Users.Add(new ApplicationUser {
                UserName = "******", PhoneNumber = "123"
            });
            Users.Add(new ApplicationUser {
                UserName = "******", PhoneNumber = "123"
            });

            foreach (var user in Users)
            {
                var result = _userManager.CreateAsync(user, user.UserName + user.PhoneNumber + "!").Result;
                if (result.Succeeded)
                {
                }
            }

            context.SaveChanges();
        }
コード例 #6
0
 private void SeedGrades(BrorepDbContext context)
 {
 }
コード例 #7
0
 private void SeedSubmissions(BrorepDbContext context)
 {
 }