Ejemplo n.º 1
0
        private static void AddStudent(string fName, string lName, string number, Course course)
        {
            var db = new UniversityContext();

            var student = new Student();

            student.FirstName = fName;
            student.LastName = lName;
            student.Number = number;
            student.Courses.Add(course);

            db.Students.Add(student);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<UniversityContext, Configuration>());

            var db = new UniversityContext();
            var student = new Student { Name = "Pesho", Number = 11111 };
            var studentTwo = new Student { Name = "Misho", Number = 22222 };
            var studentThree = new Student { Name = "Gosho", Number = 33333 };
            var course = new Course { Name = "Programming 101", Description = "Introduction to Programming", Materials = "Youtube videos" };
            student.Homeworks.Add(new Homework { Student = student, Content = "Some content" });
            course.Homeworks.Add(new Homework { Course = course, Content = "Some content" });
            db.Students.Add(student);
            db.Students.Add(studentTwo);
            db.Students.Add(studentThree);
            db.Courses.Add(course);
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        internal static void Initialize(IServiceProvider services)
        {
            var options = services.GetRequiredService <DbContextOptions <UniversityContext> >();

            using (var context = new UniversityContext(options))
            {
                if (context.Student.Any())
                {
                    context.Student.RemoveRange(context.Student);
                    context.Course.RemoveRange(context.Course);
                    context.Enrollment.RemoveRange(context.Enrollment);
                }

                var students = new List <Student>();
                for (int i = 0; i < 100; i++)
                {
                    var name    = Faker.Name.FullName();
                    var student = new Student
                    {
                        Name    = name,
                        Email   = Faker.Internet.Email(name),
                        Address = new Address
                        {
                            Street = Faker.Address.StreetAddress(),
                            City   = Faker.Address.City()
                        }
                    };
                    students.Add(student);
                }
                context.Student.AddRange(students);

                var textInfo = new CultureInfo("en-us", false).TextInfo;
                var courses  = new List <Course>();
                for (int i = 0; i < 10; i++)
                {
                    var course = new Course
                    {
                        Title = textInfo.ToTitleCase(Faker.Company.CatchPhrase())
                    };
                    courses.Add(course);
                }
                context.Course.AddRange(courses);
                context.SaveChanges();

                var enrollments = new List <Enrollment>();
                foreach (var student in students)
                {
                    foreach (var course in courses)
                    {
                        if (Faker.RandomNumber.Next(5) == 0)
                        {
                            var enrollment = new Enrollment
                            {
                                Course  = course,
                                Student = student,
                                Grade   = Faker.RandomNumber.Next(1, 6)
                            };
                            enrollments.Add(enrollment);
                        }
                    }
                }
                context.Enrollment.AddRange(enrollments);
                context.SaveChanges();
            }
        }
Ejemplo n.º 4
0
        public static void Initialize(UniversityContext context)
        {
            context.Database.EnsureCreated();

            if (context.Students.Any())
            {
                return;
            }

            var students = new Student[]
            {
                new Student {
                    LastName = "Сергей", FirstMidName = "Александров", EnrollmentDate = DateTime.Parse("05-09-2015")
                },
                new Student {
                    LastName = "Виктор", FirstMidName = "Еловой", EnrollmentDate = DateTime.Parse("01-10-2014")
                },
                new Student {
                    LastName = "Артем", FirstMidName = "Петров", EnrollmentDate = DateTime.Parse("08-05-2015")
                },
                new Student {
                    LastName = "Андрей", FirstMidName = "Голубев", EnrollmentDate = DateTime.Parse("07-04-2017")
                },
                new Student {
                    LastName = "Светлана", FirstMidName = "Максимова", EnrollmentDate = DateTime.Parse("05-09-2015")
                },
                new Student {
                    LastName = "Максим", FirstMidName = "Федоров", EnrollmentDate = DateTime.Parse("01-10-2014")
                },
                new Student {
                    LastName = "Артур", FirstMidName = "Панов", EnrollmentDate = DateTime.Parse("08-05-2015")
                },
                new Student {
                    LastName = "Андрей", FirstMidName = "Змеев", EnrollmentDate = DateTime.Parse("07-04-2017")
                },
                new Student {
                    LastName = "Ян", FirstMidName = "Левин", EnrollmentDate = DateTime.Parse("05-09-2017")
                },
                new Student {
                    LastName = "Иван", FirstMidName = "Абрамов", EnrollmentDate = DateTime.Parse("01-09-2017")
                },
                new Student {
                    LastName = "Елена", FirstMidName = "Никонова", EnrollmentDate = DateTime.Parse("06-12-2014")
                },
                new Student {
                    LastName = "Нино", FirstMidName = "Кавхадзе", EnrollmentDate = DateTime.Parse("14-07-2015")
                }
            };

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

            if (context.Courses.Any())
            {
                return;
            }

            var courses = new Course[]
            {
                new Course {
                    Title = "Химия", Credits = 3
                },
                new Course {
                    Title = "Микроэкономика", Credits = 3
                },
                new Course {
                    Title = "Макроэкономика", Credits = 3
                },
                new Course {
                    Title = "Физика", Credits = 4
                },
                new Course {
                    Title = "Тригонометрия", Credits = 4
                },
                new Course {
                    Title = "Исскуство", Credits = 3
                },
                new Course {
                    Title = "Литература", Credits = 4
                }
            };

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

            if (context.Enrollments.Any())
            {
                return;
            }

            var enrollments = new Enrollment[]
            {
                new Enrollment {
                    StudentID = 1, CourseID = 1, Grade = Grade.A
                },
                new Enrollment {
                    StudentID = 1, CourseID = 2, Grade = Grade.C
                },
                new Enrollment {
                    StudentID = 1, CourseID = 3, Grade = Grade.B
                },
                new Enrollment {
                    StudentID = 2, CourseID = 4, Grade = Grade.B
                },
                new Enrollment {
                    StudentID = 2, CourseID = 5, Grade = Grade.F
                },
                new Enrollment {
                    StudentID = 2, CourseID = 6, Grade = Grade.F
                },
                new Enrollment {
                    StudentID = 3, CourseID = 6
                },
                new Enrollment {
                    StudentID = 3, CourseID = 7, Grade = Grade.A
                },
                new Enrollment {
                    StudentID = 4, CourseID = 7
                },
                new Enrollment {
                    StudentID = 4, CourseID = 6, Grade = Grade.F
                },
                new Enrollment {
                    StudentID = 5, CourseID = 2, Grade = Grade.C
                },
                new Enrollment {
                    StudentID = 6, CourseID = 4
                },
                new Enrollment {
                    StudentID = 7, CourseID = 1, Grade = Grade.A
                },
                new Enrollment {
                    StudentID = 8, CourseID = 1, Grade = Grade.A
                },
                new Enrollment {
                    StudentID = 8, CourseID = 2, Grade = Grade.C
                },
                new Enrollment {
                    StudentID = 9, CourseID = 3, Grade = Grade.B
                },
                new Enrollment {
                    StudentID = 10, CourseID = 4, Grade = Grade.B
                },
                new Enrollment {
                    StudentID = 10, CourseID = 5, Grade = Grade.F
                },
                new Enrollment {
                    StudentID = 11, CourseID = 6
                },
                new Enrollment {
                    StudentID = 11, CourseID = 7
                },
                new Enrollment {
                    StudentID = 12, CourseID = 6, Grade = Grade.F
                },
                new Enrollment {
                    StudentID = 12, CourseID = 3, Grade = Grade.C
                }
            };

            foreach (Enrollment e in enrollments)
            {
                context.Enrollments.Add(e);
            }
            context.SaveChanges();
        }
Ejemplo n.º 5
0
        public static void Initialize(IServiceProvider services)
        {
            var options = services.GetRequiredService <DbContextOptions <UniversityContext> >();

            using (var db = new UniversityContext(options))
            {
                if (db.Students.Any())
                {
                    //db.Students.RemoveRange(db.Students);
                    return;
                }


                var fake = new Faker("sv");

                var students = new List <Student>();

                for (int i = 0; i < 200; i++)
                {
                    var fName = fake.Name.FirstName();
                    var lName = fake.Name.LastName();

                    var student = new Student
                    {
                        FirstName = fName,
                        LastName  = lName,
                        Email     = fake.Internet.Email($"{fName} {lName}"),
                        Avatar    = fake.Internet.Avatar(),
                        Adress    = new Adress
                        {
                            City    = fake.Address.City(),
                            Street  = fake.Address.StreetAddress(),
                            ZipCode = fake.Address.ZipCode()
                        }
                    };

                    students.Add(student);
                }

                db.AddRange(students);

                var courses = new List <Course>();

                for (int i = 0; i < 20; i++)
                {
                    var course = new Course
                    {
                        Title = fake.Company.CatchPhrase()
                    };

                    courses.Add(course);
                }

                db.AddRange(courses);

                var enrollments = new List <Enrollment>();

                foreach (var student in students)
                {
                    foreach (var course in courses)
                    {
                        if (fake.Random.Int(0, 5) == 0)
                        {
                            var enrollment = new Enrollment
                            {
                                Course  = course,
                                Student = student,
                                Grade   = fake.Random.Int(1, 5)
                            };
                            enrollments.Add(enrollment);
                        }
                    }
                }

                db.AddRange(enrollments);
                db.SaveChanges();
            }
        }
Ejemplo n.º 6
0
 public void Insert(TEntity entity)
 {
     Entities.Add(entity);
     _context.SaveChanges();
 }
Ejemplo n.º 7
0
        public static void Initialize(UniversityContext context)
        {
            context.Database.EnsureCreated();


            if (context.Students.Any())
            {
                return;
            }

            var students = new Student[]
            {
                new Student {
                    StudentId       = "1000", FirstName = "Harry", LastName = "Potter", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://upload.wikimedia.org/wikipedia/sco/4/44/HarryPotter5poster.jpg"
                },
                new Student {
                    StudentId       = "1001", FirstName = "Hermione", LastName = "Granger", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://myhero.com/images/guest/g282317/hero105677/image2.jpg"
                },
                new Student {
                    StudentId       = "1002", FirstName = "Ronald", LastName = "Weasley", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://vignette.wikia.nocookie.net/harrypotterfanon/images/5/56/Ron_Weasley_%28Scopatore%29.jpg/revision/latest?cb=20160120050600"
                },
                new Student {
                    StudentId       = "1003", FirstName = "Ginny", LastName = "Weasley", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://vignette.wikia.nocookie.net/harrypotter/images/8/8b/Ginny_Weasley_hbp_promo.jpg/revision/latest?cb=20180322181904"
                },
                new Student {
                    StudentId       = "1004", FirstName = "Neville", LastName = "Longbottom", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://vignette.wikia.nocookie.net/harrypotter/images/1/10/Neville-promo-pics-neville-longbottom-28261912-390-520.jpg/revision/latest?cb=20140610141612"
                },
                new Student {
                    StudentId       = "1005", FirstName = "Luna", LastName = "Lovegood", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://images.ctfassets.net/usf1vwtuqyxm/t6GVMDanqSKGOKaCWi8oi/74b6816d9f913623419b98048ec87d25/LunaLovegood_WB_F5_LunaLovegoodPromoCloseUp_Promo_080615_Port.jpg?fm=jpg"
                },
                new Student {
                    StudentId       = "1006", FirstName = "Draco", LastName = "Malfoy", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://vignette.wikia.nocookie.net/hogwarts-life/images/8/82/Draco_Malfoy.jpg/revision/latest?cb=20170112183355"
                },
                new Student {
                    StudentId       = "1007", FirstName = "Cedric", LastName = "Diggory", EnrollmentDate = DateTime.Parse("2018-09-01"),
                    AcquiredCredits = 100, CurrentSemestar = 4, EducationLevel = "High School Diploma", ProfilePicture = "https://images-na.ssl-images-amazon.com/images/I/51-mjy5XsML._AC_.jpg"
                }
            };

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

            // if(context.Teachers.Any()){
            //  return;
            // }
            var teachers = new Teacher[]
            {
                new Teacher {
                    FirstName    = "Severus", LastName = "Snape", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "304", HireDate = DateTime.Parse("2003-07-01"), ProfilePicture = "https://lh3.googleusercontent.com/proxy/Oz8V-0G0RvI5Emt150FC2_mp2GmYz0CVuacTqiqTz52dE7RugmdMlztlIO42DGhXhCdarepKzOWsS_Lf4rdu26EEf0qZyXedGqPLtDe366i6nIInK65CdU8Tmg"
                },
                new Teacher {
                    FirstName    = "Minerva", LastName = "McGonagall", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "201", HireDate = DateTime.Parse("2004-08-02"), ProfilePicture = "https://i.pinimg.com/originals/8b/71/30/8b71304ce2660f2943b2639ae2a6ebba.jpg"
                },
                new Teacher {
                    FirstName    = "Albus", LastName = "Dumbledore", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "804", HireDate = DateTime.Parse("2002-06-05"), ProfilePicture = "https://images.ctfassets.net/usf1vwtuqyxm/1dmmUJzpRcWaUmMOCu8QwO/7e013145694566076d47fd004fd604c2/AlbusDumbledore_WB_F6_DumbledoreSittingInChair_Promo_080615_Port.jpg?fm=jpg"
                },
                new Teacher {
                    FirstName    = "Filius", LastName = "Flitwick", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "312", HireDate = DateTime.Parse("2003-04-23"), ProfilePicture = "https://images.ctfassets.net/usf1vwtuqyxm/7zwF0icg0kQW2ejGM7mqw2/29f2491ad063a317fb55a6f6c69aecce/flitwich-quiz-image.jpg?fm=jpg"
                },
                new Teacher {
                    FirstName    = "Pomona", LastName = "Sprout", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "901", HireDate = DateTime.Parse("2005-09-23"), ProfilePicture = "https://vignette.wikia.nocookie.net/hogwarts-life/images/7/7d/HP72-FP-00573.jpg/revision/latest/top-crop/width/360/height/450?cb=20170122163222"
                },
                new Teacher {
                    FirstName    = "Horace", LastName = "Slughorn", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "134", HireDate = DateTime.Parse("2004-02-12"), ProfilePicture = "https://pbs.twimg.com/media/EAezZ-gXUAU3aD-.jpg"
                },
                new Teacher {
                    FirstName    = "Rubeus", LastName = "Hagrid", Degree = "Doctorate", AcademicRank = "Full professor",
                    OfficeNumber = "784", HireDate = DateTime.Parse("2002-08-16"), ProfilePicture = "https://images-na.ssl-images-amazon.com/images/I/51K6H%2BEhr1L._AC_.jpg"
                }
            };

            foreach (Teacher t in teachers)
            {
                context.Teachers.Add(t);
            }
            context.SaveChanges();

            // if(context.Courses.Any()){
            //   return;
            //}

            var courses = new Course[]
            {
                new Course {
                    CourseID       = 1050, Title = "Potions", Credits = 3, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Snape").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "McGonagall").TeacherId
                },
                new Course {
                    CourseID       = 4022, Title = "History of Magic", Credits = 3, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Snape").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "McGonagall").TeacherId
                },
                new Course {
                    CourseID       = 4041, Title = "Defence Againts the Dark Arts", Credits = 3, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Dumbledore").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "Flitwick").TeacherId
                },
                new Course {
                    CourseID       = 1045, Title = "Care of Magical Creatures", Credits = 3, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Dumbledore").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "Flitwick").TeacherId
                },
                new Course {
                    CourseID       = 3141, Title = "Astronomy", Credits = 4, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Sprout").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "Slughorn").TeacherId
                },
                new Course {
                    CourseID       = 2021, Title = "Flying", Credits = 3, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Sprout").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "Hagrid").TeacherId
                },
                new Course {
                    CourseID       = 2042, Title = "Study of Ancient Runes", Credits = 4, Semester = 4, Programme = "New programme", EducationLevel = "High School Diploma",
                    FirstTeacherId = teachers.Single(s => s.LastName == "Slughorn").TeacherId, SecondTeacherId = teachers.Single(s => s.LastName == "Hagrid").TeacherId
                }
            };

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



            var enrollments = new Enrollment[]
            {
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Potter").ID, CourseID = courses.Single(c => c.Title == "Potions").CourseID, Semester = "4", Year = 2,
                    Grade     = 10, SeminalUrl = "abc", ProjectUrl = "ab1", ExamPoints = 100, SeminalPoints = 100, ProjectPoints = 100, AdditionalPoints = 5, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Potter").ID, CourseID = courses.Single(c => c.Title == "History of Magic").CourseID, Semester = "4", Year = 2,
                    Grade     = 9, SeminalUrl = "abd", ProjectUrl = "ab2", ExamPoints = 80, SeminalPoints = 90, ProjectPoints = 100, AdditionalPoints = 0, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Granger").ID, CourseID = courses.Single(c => c.Title == "History of Magic").CourseID, Semester = "4", Year = 2,
                    Grade     = 8, SeminalUrl = "abe", ProjectUrl = "ab3", ExamPoints = 50, SeminalPoints = 80, ProjectPoints = 100, AdditionalPoints = 3, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Granger").ID, CourseID = courses.Single(c => c.Title == "Defence Againts the Dark Arts").CourseID, Semester = "4", Year = 2,
                    Grade     = 7, SeminalUrl = "abf", ProjectUrl = "ab4", ExamPoints = 70, SeminalPoints = 50, ProjectPoints = 50, AdditionalPoints = 2, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.FirstName == "Ronald").ID, CourseID = courses.Single(c => c.Title == "Defence Againts the Dark Arts").CourseID, Semester = "4", Year = 2,
                    Grade     = 6, SeminalUrl = "abg", ProjectUrl = "ab5", ExamPoints = 50, SeminalPoints = 50, ProjectPoints = 50, AdditionalPoints = 5, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.FirstName == "Ronald").ID, CourseID = courses.Single(c => c.Title == "Care of Magical Creatures").CourseID, Semester = "4", Year = 2,
                    Grade     = 6, SeminalUrl = "abh", ProjectUrl = "ab6", ExamPoints = 40, SeminalPoints = 50, ProjectPoints = 60, AdditionalPoints = 3, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.FirstName == "Giny").ID, CourseID = courses.Single(c => c.Title == "Care of Magical Creatures").CourseID, Semester = "4", Year = 2,
                    Grade     = 9, SeminalUrl = "abi", ProjectUrl = "ab7", ExamPoints = 70, SeminalPoints = 100, ProjectPoints = 60, AdditionalPoints = 6, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.FirstName == "Giny").ID, CourseID = courses.Single(c => c.Title == "Astronomy").CourseID, Semester = "4", Year = 2,
                    Grade     = 9, SeminalUrl = "abj", ProjectUrl = "ab8", ExamPoints = 80, SeminalPoints = 90, ProjectPoints = 100, AdditionalPoints = 12, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Longbottom").ID, CourseID = courses.Single(c => c.Title == "Astronomy").CourseID, Semester = "4", Year = 2,
                    Grade     = 6, SeminalUrl = "abk", ProjectUrl = "ab9", ExamPoints = 50, SeminalPoints = 30, ProjectPoints = 40, AdditionalPoints = 8, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Longbottom").ID, CourseID = courses.Single(c => c.Title == "Flying").CourseID, Semester = "4", Year = 2,
                    Grade     = 8, SeminalUrl = "abl", ProjectUrl = "ab10", ExamPoints = 100, SeminalPoints = 50, ProjectPoints = 100, AdditionalPoints = 0, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Lovegood").ID, CourseID = courses.Single(c => c.Title == "Flying").CourseID, Semester = "4", Year = 2,
                    Grade     = 7, SeminalUrl = "abm", ProjectUrl = "ab11", ExamPoints = 70, SeminalPoints = 70, ProjectPoints = 70, AdditionalPoints = 10, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Lovegood").ID, CourseID = courses.Single(c => c.Title == "Study of Ancient Runes").CourseID, Semester = "4", Year = 2,
                    Grade     = 10, SeminalUrl = "abn", ProjectUrl = "ab12", ExamPoints = 100, SeminalPoints = 100, ProjectPoints = 100, AdditionalPoints = 3, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Malfoy").ID, CourseID = courses.Single(c => c.Title == "Study of Ancient Runes").CourseID, Semester = "4", Year = 2,
                    Grade     = 6, SeminalUrl = "abo", ProjectUrl = "ab13", ExamPoints = 50, SeminalPoints = 30, ProjectPoints = 40, AdditionalPoints = 8, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Malfoy").ID, CourseID = courses.Single(c => c.Title == "Defence Againts the Dark Arts").CourseID, Semester = "4", Year = 2,
                    Grade     = 8, SeminalUrl = "abp", ProjectUrl = "ab14", ExamPoints = 100, SeminalPoints = 50, ProjectPoints = 100, AdditionalPoints = 0, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Diggory").ID, CourseID = courses.Single(c => c.Title == "Flying").CourseID, Semester = "4", Year = 2,
                    Grade     = 7, SeminalUrl = "abq", ProjectUrl = "ab15", ExamPoints = 70, SeminalPoints = 70, ProjectPoints = 70, AdditionalPoints = 10, FinishDate = DateTime.Parse("2020-10-01")
                },
                new Enrollment {
                    StudentID = students.Single(s => s.LastName == "Diggory").ID, CourseID = courses.Single(c => c.Title == "Potions").CourseID, Semester = "4", Year = 2,
                    Grade     = 10, SeminalUrl = "abr", ProjectUrl = "ab16", ExamPoints = 100, SeminalPoints = 100, ProjectPoints = 100, AdditionalPoints = 3, FinishDate = DateTime.Parse("2020-10-01")
                }
            };

            foreach (Enrollment e in enrollments)
            {
                context.Enrollments.Add(e);
            }
            context.SaveChanges();


            if (context.AppUser.Any())
            {
                return;
            }

            context.AppUser.AddRange(
                new AppUser
            {
                Name     = "Admin",
                Email    = "*****@*****.**",
                Password = "******"
            }
                );
            context.SaveChanges();
        }