public bool Insert(Class cls, string InstructorLastname) { var instCtrl = new InstructorsController(Connection); var inst = instCtrl.GetByLastname(InstructorLastname); if (inst == null) { return(false); } cls.InstructorId = inst.Id; return(Insert(cls)); }
public IEnumerable <ClassWithInstructor> GetClassesWithInstructor() { var instCtrl = new InstructorsController(Connection); var classes = from c in GetAll() join i in instCtrl.GetAll() on c.InstructorId equals i.Id select new ClassWithInstructor { Class = c, Instructor = i }; return(classes); }