Exemplo n.º 1
0
        private async Task seedDatabase()
        {
            scienceRoom = new ClassRoom()
            {
                ClassRoomName     = "Science Room",
                SeatsHorizontally = 10,
                SeatsVertically   = 8
            };
            scienceRoom = new ClassRoom()
            {
                ClassRoomName     = "Science Room",
                SeatsHorizontally = 10,
                SeatsVertically   = 8
            };
            jonathan = new Teacher()
            {
                TeacherName = "jonathan"
            };
            heber = new Teacher()
            {
                TeacherName = "not jonathan"
            };
            sam = new Student()
            {
                StudentName = "sam"
            };
            ben = new Student()
            {
                StudentName = "ben"
            };
            tim = new Student()
            {
                StudentName = "tim"
            };
            await classRepository.AddClassRoomAsync(scienceRoom);

            await classRepository.AddTeacherAsync(jonathan);

            await classRepository.AddTeacherAsync(heber);

            await studentRepository.AddStudentAsync(sam);

            await studentRepository.AddStudentAsync(ben);

            await studentRepository.AddStudentAsync(tim);

            mathClass = new ClassModel()
            {
                ClassName   = "math",
                TeacherId   = jonathan.TeacherId,
                ClassRoomId = scienceRoom.ClassRoomId
            };
            scienceClass = new ClassModel()
            {
                ClassName   = "science",
                TeacherId   = jonathan.TeacherId,
                ClassRoomId = scienceRoom.ClassRoomId
            };
            notScienceClass = new ClassModel()
            {
                ClassName   = "not science",
                TeacherId   = heber.TeacherId,
                ClassRoomId = scienceRoom.ClassRoomId
            };
            await classRepository.AddClassAsync(mathClass);

            await classRepository.AddClassAsync(scienceClass);

            await classRepository.AddClassAsync(notScienceClass);

            math1010 = new Course()
            {
                CourseName = "Math 1010",
                TeacherId  = jonathan.TeacherId
            };
            await courseRepository.AddCourseAsync(math1010);

            await classRepository.EnrollStudentAsync(sam.StudentId, mathClass.ClassId, math1010.CourseId);

            await classRepository.EnrollStudentAsync(sam.StudentId, scienceClass.ClassId, math1010.CourseId);

            await classRepository.EnrollStudentAsync(sam.StudentId, notScienceClass.ClassId, math1010.CourseId);
        }