//For Enrolment Controller public void AddEnrolment(int StudentId, int CourseId) { Student student = _ctx.Students.Find(StudentId); Course course = _ctx.Courses.Find(CourseId); var newEnrol = new Enrolment { StudentId = StudentId, CourseId = CourseId }; _ctx.Enrolments.Add(newEnrol); Save(); }