public void Delete(Lesson lesson) { MistakeModel mistakeModel = new MistakeModel(); HomeworkModel homeworkModel = new HomeworkModel(); mistakeModel.DeleteMadeMistakeOfLesson(lesson.ClassId, lesson.ClassNumber); homeworkModel.DeleteHomeWorkOfLesson(lesson.ClassId, lesson.ClassNumber); this.dataContext.Lessons.Remove(lesson); this.dataContext.SaveChanges(); }
public void Delete(Register register) { MistakeModel mistakeModel = new MistakeModel(); HomeworkModel homeworkModel = new HomeworkModel(); RequestModel requestModel = new RequestModel(); mistakeModel.DeleteMadeMistakeOfRegister(register.StudentUsername, register.ClassId); homeworkModel.DeleteHomeWorkOfRegister(register.StudentUsername, register.ClassId); requestModel.DeleteRequestOfRegister(register.StudentUsername, register.ClassId); this.dataContext.Registers.Remove(register); this.dataContext.SaveChanges(); }