public bool DelTeaching(int lecturerId, int courseId) { Teaching teaching = _ctx.Teachings.Find(lecturerId, courseId); if (teaching != null) { _ctx.Teachings.Remove(teaching); } return(save() ); }
public void AddTeaching(int lecturerId, int courseId) { Lecturer lecturer = _ctx.Lecturers.Find(lecturerId); Course course = _ctx.Courses.Find(courseId); Teaching teaching = new Teaching { LecturerId = lecturerId, CourseId = courseId, Lecturer = lecturer, Course = course }; _ctx.Teachings.Add(teaching); save(); }