public ActionResult About() { ViewBag.Message = "Your application description page."; var repository = new InstructorRepository(); var instructors = repository.GetAll(); var existingStudent = new StudentRepository().GetById(1); var instructor = instructors[0]; //instructor.FirstName = "Barara"; //instructor.TeachingCourses[0].Enrollments.Add( // new Enrollment() // { // Student = existingStudent, // Grade = 100 // //Course = instructor.TeachingCourses[0] // } // ); instructor.TeachingCourses.RemoveAt(2); repository.InsertOrUpdate(instructor); return View(instructors); }
private void CreateNewCourse() { var instructorRepo = new InstructorRepository(); var instructor = instructorRepo.GetById(2); var course = new Course(); course.Title = "English"; course.Credits = 5; course.InstructorId = instructor.Id; //course.Instructor = instructor; course.Enrollments = new List<Enrollment>() { new Enrollment() { StudentId = 7, Grade = 80 } }; var courseRepo = new CourseRepository(); courseRepo.InsertOrUpdate(course); }
private void GetInstructor() { var instructorRepo = new InstructorRepository(); var instructor = instructorRepo.GetById(2); }