//Create a new Instructor and assign instructor to the Course private static void Q1() { string menu1 = "Please enter new instructor First Name"; string instruFirstName = AskInput(menu1); string menu2 = "Please enter new instructor Last Name"; string instruLastName = AskInput(menu2); var newInstructor = new Person(); newInstructor.FirstName = instruFirstName; newInstructor.LastName = instruLastName; db.Person.Add(newInstructor); db.SaveChanges(); listData.ListCourse(); string menu6 = "Please Choose the CourseID to be assigned"; string courseID = AskInput(menu6); CourseInstructor newCI = new CourseInstructor(); newCI.CourseID = short.Parse(courseID); var person = db.Person.Where(p => p.FirstName == instruFirstName & p.LastName == instruLastName) .OrderByDescending(p => p.PersonID) .First(); if (person != null) { newCI.PersonID = person.PersonID; OfficeAssignment newOA = new OfficeAssignment(); newOA.InstructorID = person.PersonID; db.CourseInstructor.Add(newCI); db.OfficeAssignment.Add(newOA); } db.SaveChanges(); Success(); }