private static void AssignKnownProfessors(UniversityDbContext dbContext) { var course = dbContext.Courses.Find("physics_1"); var professor = dbContext.Professors.Find("katie"); course.AssignProfessorToCourse(professor); dbContext.SaveChanges(); }
private static void SeedProfessors(UniversityDbContext dbContext) { if (!dbContext.Professors.Any()) { dbContext.Professors.AddRange(new[] { Professor.Create("jason", "Jason", "Bourne", "*****@*****.**", "JaBo"), Professor.Create("chuck", "Chuck", "Norris", "*****@*****.**", "ChNo"), Professor.Create("katie", "Katie", "Bouman", "*****@*****.**", "KaBo"), }); dbContext.SaveChanges(); } }
private static void SeedStudents(UniversityDbContext dbContext) { if (!dbContext.Students.Any()) { dbContext.Students.AddRange(new[] { Student.Create(_id.NewEntityId(), "Hansi", "Hinterseer", "*****@*****.**", "MaiHaHi"), Student.Create(_id.NewEntityId(), "Florian", "Silberfischel", "*****@*****.**", "FlSi"), Student.Create(_id.NewEntityId(), "Seven", "Of Nine", "*****@*****.**", "SeNi"), }); dbContext.SaveChanges(); } }
private static void SeedCourses(UniversityDbContext dbContext) { if (!dbContext.Courses.Any()) { dbContext.Courses.AddRange(new[] { Course.Create("math_1", "Math_1", "How to take a picture of a black hole", "How to take a picture of a black hole"), Course.Create("physics_1", "Physics_1", "How to take a picture of a black hole", "How to take a picture of a black hole"), Course.Create("selfdefense_1", "SelfDefense_1", "Roundhouse Kick", "How to do the perfect Roundhouse Kick."), Course.Create("memory_1", "Memory_1", "Memory lost, what now", "Guidelines to cope with memory loss."), }); dbContext.SaveChanges(); } }