Пример #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new RazorPagesCourseContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <RazorPagesCourseContext> >()))
            {
                // Look for any Courses.
                if (context.Course.Any())
                {
                    return;   // DB has been seeded
                }

                context.Course.AddRange(
                    new Course
                {
                    Number      = "1-W-3",
                    Title       = "PHP",
                    Date        = DateTime.Parse("2019-2-12"),
                    Semester    = "2019-W",
                    Description = "nan",
                    Credits     = 3.2m
                },

                    new Course
                {
                    Number      = "1-W-4",
                    Title       = "jsp",
                    Date        = DateTime.Parse("2019-2-12"),
                    Semester    = "2019-W",
                    Description = "nan",
                    Credits     = 2.2m
                },
                    new Course
                {
                    Number      = "1-W-4",
                    Title       = "web design",
                    Date        = DateTime.Parse("2019-2-12"),
                    Semester    = "2019-W",
                    Description = "nan",
                    Credits     = 2.2m
                }
                    );
                context.SaveChanges();
            }
        }
Пример #2
0
 public EditModel(RazorPagesCourse.Models.RazorPagesCourseContext context)
 {
     _context = context;
 }
Пример #3
0
 public DeleteModel(RazorPagesCourse.Models.RazorPagesCourseContext context)
 {
     _context = context;
 }
Пример #4
0
 public IndexModel(RazorPagesCourse.Models.RazorPagesCourseContext context)
 {
     _context = context;
 }