Esempio n. 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new BSUStudentContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <BSUStudentContext> >()))
            {
                // Look for any movies.
                if (context.Student.Any())
                {
                    return;   // DB has been seeded
                }

                context.Student.AddRange(
                    new Student
                {
                    BSU_Username    = "******",
                    GitHub_Username = "******",
                    First_Name      = "Joebob",
                    Last_Name       = "Smith",
                    Repo            = "https://github.com/joe1234/CSHU-253-1-F18.git",
                    CourseName      = "CSHU-253-1-F18"
                }
                    );
                context.SaveChanges();
            }
        }
 public StudentsController(BSUStudentContext context)
 {
     _context = context;
 }