public tblExam AddExam(Exam createdExam) { try { tblExam exam = new tblExam(); //Maak een exam aan en voeg alle gegevens toe n.a.v. de meegegeven exam. exam.starttime = createdExam.Starttime; exam.endtime = createdExam.Endtime; exam.id = createdExam.Examnr; exam.questionnaire = createdExam.Questionnaire.ID; exam.lecture = createdExam.Lecture.ID; db.tblExams.InsertOnSubmit(exam); //Voeg de exam toe aan de database en submit de changes. db.SubmitChanges(); return exam; } catch (SqlException ex) { MessageBox.Show(ex.Message); return null; //Wanneer er iets fout gaat, laat een messagebox zien met de SQL exception. } }
private void detach_exams(tblExam entity) { this.SendPropertyChanging(); entity.tblLecture = null; }
partial void DeletetblExam(tblExam instance);
partial void UpdatetblExam(tblExam instance);
partial void InserttblExam(tblExam instance);
private void detach_tblExams(tblExam entity) { this.SendPropertyChanging(); entity.tblQuestionnaire = null; }
private void attach_exams(tblExam entity) { this.SendPropertyChanging(); entity.tblQuestion = this; }