public SQLCoursesRepository(LocalDbContext context)
 {
     this._context = context;
 }
 public SQLInstructorsRepository(LocalDbContext context)
 {
     _context = context;
 }
 public SQLStudentsRepository(LocalDbContext context)
 {
     this._context = context;
 }
        public static void Initialize(LocalDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Students.Any())
            {
                return;   // DB has been seeded
            }

            var students = new Student[]
            {
                new Student {
                    FirstName = "Aaa", LastName = "Aa", EmailAddress = "*****@*****.**", PhoneNumber = "2043114501", Course = "Math"
                },
                new Student {
                    FirstName = "Bbb", LastName = "Bb", EmailAddress = "*****@*****.**", PhoneNumber = "2043114502", Course = "Math"
                },
                new Student {
                    FirstName = "Ccc", LastName = "Cc", EmailAddress = "*****@*****.**", PhoneNumber = "2043114503", Course = "English"
                },
                new Student {
                    FirstName = "Ddd", LastName = "Dd", EmailAddress = "*****@*****.**", PhoneNumber = "2043114504", Course = "French"
                },
                new Student {
                    FirstName = "Eee", LastName = "Ee", EmailAddress = "*****@*****.**", PhoneNumber = "2043114505", Course = "Art"
                },
                new Student {
                    FirstName = "Fff", LastName = "Ff", EmailAddress = "*****@*****.**", PhoneNumber = "2043114506", Course = "Sports"
                },
                new Student {
                    FirstName = "Ggg", LastName = "Gg", EmailAddress = "*****@*****.**", PhoneNumber = "2043114507", Course = "sports"
                },
                new Student {
                    FirstName = "Hhh", LastName = "Hh", EmailAddress = "*****@*****.**", PhoneNumber = "2043114508", Course = "Math"
                },
                new Student {
                    FirstName = "Iii", LastName = "Ii", EmailAddress = "*****@*****.**", PhoneNumber = "2043114509", Course = "Art"
                },
                new Student {
                    FirstName = "Jjj", LastName = "Jj", EmailAddress = "*****@*****.**", PhoneNumber = "2043114510", Course = "French"
                },
                new Student {
                    FirstName = "Kkk", LastName = "Kk", EmailAddress = "*****@*****.**", PhoneNumber = "2043114511", Course = "Math"
                },
            };

            foreach (Student s in students)
            {
                context.Students.Add(s);
            }
            context.SaveChanges();

            var courses = new Course[]
            {
                new Course {
                    CourseName = "Math", CourseNumber = "111", Description = "Math description"
                },
                new Course {
                    CourseName = "English", CourseNumber = "222", Description = "English description"
                },
                new Course {
                    CourseName = "French", CourseNumber = "333", Description = "French description"
                },
                new Course {
                    CourseName = "Art", CourseNumber = "444", Description = "Art description"
                },
                new Course {
                    CourseName = "Sports", CourseNumber = "555", Description = "Sports description"
                },
            };

            foreach (Course c in courses)
            {
                context.Courses.Add(c);
            }
            context.SaveChanges();

            var instructors = new Instructor[]
            {
                new Instructor()
                {
                    FirstName = "Mike", LastName = "Ai", EmailAddress = "*****@*****.**", Course = "Math"
                },
                new Instructor()
                {
                    FirstName = "Neil", LastName = "Bi", EmailAddress = "*****@*****.**", Course = "English"
                },
                new Instructor()
                {
                    FirstName = "Ellie", LastName = "Ci", EmailAddress = "*****@*****.**", Course = "French"
                },
                new Instructor()
                {
                    FirstName = "Sam", LastName = "Di", EmailAddress = "*****@*****.**", Course = "Art"
                },
                new Instructor()
                {
                    FirstName = "Bill", LastName = "Ei", EmailAddress = "*****@*****.**", Course = "Sports"
                }
            };

            foreach (Instructor sc in instructors)
            {
                context.Instructors.Add(sc);
            }
            context.SaveChanges();

            var studentCourses = new StudentCourse[]
            {
                new StudentCourse()
                {
                    StudentId = 1, CourseId = 1
                },
                new StudentCourse()
                {
                    StudentId = 1, CourseId = 2
                },
                new StudentCourse()
                {
                    StudentId = 1, CourseId = 3
                },
                new StudentCourse()
                {
                    StudentId = 1, CourseId = 4
                },
                new StudentCourse()
                {
                    StudentId = 1, CourseId = 5
                },
                new StudentCourse()
                {
                    StudentId = 2, CourseId = 1
                },
                new StudentCourse()
                {
                    StudentId = 2, CourseId = 2
                },
                new StudentCourse()
                {
                    StudentId = 2, CourseId = 3
                },
                new StudentCourse()
                {
                    StudentId = 3, CourseId = 1
                },
                new StudentCourse()
                {
                    StudentId = 4, CourseId = 2
                },
                new StudentCourse()
                {
                    StudentId = 5, CourseId = 3
                },
                new StudentCourse()
                {
                    StudentId = 6, CourseId = 4
                },
                new StudentCourse()
                {
                    StudentId = 7, CourseId = 5
                },
                new StudentCourse()
                {
                    StudentId = 8, CourseId = 1
                },
                new StudentCourse()
                {
                    StudentId = 9, CourseId = 2
                },
                new StudentCourse()
                {
                    StudentId = 10, CourseId = 3
                },
                new StudentCourse()
                {
                    StudentId = 10, CourseId = 4
                },
                new StudentCourse()
                {
                    StudentId = 4, CourseId = 5
                },
            };

            foreach (StudentCourse f in studentCourses)
            {
                context.StudentsCourses.Add(f);
            }
            context.SaveChanges();
        }