예제 #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new RazorPagesMegaContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <RazorPagesMegaContext> >()))
            {
                // Look for any movies.
                if (context.Office.Any())
                {
                    return;   // DB has been seeded
                }

                context.Office.AddRange(
                    new Office
                {
                    BranchID   = 4,
                    OfficeName = "Surabaya Kertajaya",
                    StartDate  = DateTime.Parse("1999-8-1")
                },

                    new Office
                {
                    BranchID   = 5,
                    OfficeName = "Denpasar",
                    StartDate  = DateTime.Parse("1989-9-30")
                },

                    new Office
                {
                    BranchID   = 6,
                    OfficeName = "Jakarta Kota",
                    StartDate  = DateTime.Parse("1997-8-8")
                },

                    new Office
                {
                    BranchID   = 7,
                    OfficeName = "Surabaya Kembang Jepun",
                    StartDate  = DateTime.Parse("1969-9-1")
                }
                    );
                context.SaveChanges();
            }
        }
예제 #2
0
 public IndexModel(RazorPagesMega.Models.RazorPagesMegaContext context)
 {
     _context = context;
 }
예제 #3
0
 public DetailsModel(RazorPagesMega.Models.RazorPagesMegaContext context)
 {
     _context = context;
 }
예제 #4
0
 public EditModel(RazorPagesMega.Models.RazorPagesMegaContext context)
 {
     _context = context;
 }
예제 #5
0
 public DeleteModel(RazorPagesMega.Models.RazorPagesMegaContext context)
 {
     _context = context;
 }