コード例 #1
0
        public static void EnsureGroups(IApplicationBuilder app)
        {
            KarateKidDbContext context = app.ApplicationServices
                                         .GetRequiredService <KarateKidDbContext>();

            context.Database.Migrate();
            if (!context.Groups.Any())
            {
                context.Groups.AddRange(
                    new Groups
                {
                    groupName    = "Pszczółki",
                    TrainingDay  = Day.Sobota,
                    TrainingTime = "11.00",
                    isChecked    = false
                },
                    new Groups
                {
                    groupName    = "Skowarcz",
                    TrainingDay  = Day.Wtorek,
                    TrainingTime = "12.00",
                    isChecked    = false
                },
                    new Groups
                {
                    groupName    = "Tczew",
                    TrainingDay  = Day.Środa,
                    TrainingTime = "13.00",
                    isChecked    = false
                },
                    new Groups
                {
                    groupName    = "Różyny",
                    TrainingDay  = Day.Środa,
                    TrainingTime = "15.00",
                    isChecked    = false
                },
                    new Groups
                {
                    groupName    = "Kolnik",
                    TrainingDay  = Day.Poniedziałek,
                    TrainingTime = "21.00",
                    isChecked    = false
                },
                    new Groups
                {
                    groupName    = "Pruszcz Gdański",
                    TrainingDay  = Day.Środa,
                    TrainingTime = "14.00",
                    isChecked    = false
                }
                    );
                context.SaveChanges();
            }
        }
コード例 #2
0
        public static void EnsureKids(IApplicationBuilder app)
        {
            KarateKidDbContext context = app.ApplicationServices
                                         .GetRequiredService <KarateKidDbContext>();

            context.Database.Migrate();
            if (!context.KarateKidsAll.Any())
            {
                context.KarateKidsAll.AddRange(
                    new KarateKid
                {
                    name  = "Child",
                    phone = 919919919,
                },
                    new KarateKid
                {
                    name  = "Child1",
                    phone = 999888777,
                },
                    new KarateKid
                {
                    name  = "Child2",
                    phone = 123456789,
                },
                    new KarateKid
                {
                    name  = "Child3",
                    phone = 999888777,
                },
                    new KarateKid
                {
                    name  = "Child4",
                    phone = 999888777,
                },
                    new KarateKid
                {
                    name  = "Child5",
                    phone = 789456123,
                }
                    );

                context.SaveChanges();
            }
        }
コード例 #3
0
 public EFDateModelRepository(KarateKidDbContext ctx)
 {
     context = ctx;
 }
コード例 #4
0
 public EFGroupsRepository(KarateKidDbContext ctx)
 {
     context = ctx;
 }
コード例 #5
0
 public EFKaratekidRepository(KarateKidDbContext ctx)
 {
     context = ctx;
 }