private void FillStudent() { firstNameStudent.ForEach(firstName => { var index = firstNameStudent.IndexOf(firstName); student tmpStud = new student { salutation = salutationStudent[index], firstName = firstName, lastName = lastNameStudent[index], email = emailStudent[index], matricelNumber = matricelnumberStudent[index], studyCourse = studyCourseStudent[index], semester = semesterStudent[index] }; studDbSet.AddOne(tmpStud); if (index % 2 == 0) { studDbSet.AddStudToLab(tmpStud, labsDbset.GetById(1)); Console.WriteLine($"fill stud {tmpStud.firstName} and add them to lab {labsDbset.GetById(1).labID}"); } else { studDbSet.AddStudToLab(tmpStud, labsDbset.GetById(2)); Console.WriteLine($"fill stud {tmpStud.firstName} and add them to lab {labsDbset.GetById(2).labID}"); } }); Console.WriteLine("- - - - - - - Finished - - - - -"); }
private void AddStudToLab(student s, lab l) { // add stud to new lab context.AddStudToLab(s, l); // add present for each labdate for student context.GetLabdatesOfLab(l.labID) .ForEach(lD => { dataAccess.PresentContext.AddOne( new present { labdate_labdateID = lD.labdateID, note = "", student_studentID = s.studentID, wasPresent = 0 }); }); // add TaskDone for each Task for student context.GetTasksOfLab(l.labID) .ForEach(t => { dataAccess.TaskDoneContext.AddOne( new taskdone { isDone = 0, student_studentID = s.studentID, task_taskID = t.taskID }); }); }
private void FillStudent() { firstNameStudent.ForEach(firstName => { var index = firstNameStudent.IndexOf(firstName); student tmpStud = new student { salutation = salutationStudent[index], firstName = firstName, lastName = lastNameStudent[index], email = emailStudent[index], matricelNumber = matricelnumberStudent[index], studyCourse = studyCourseStudent[index], semester = semesterStudent[index] }; studDbSet.AddOne(tmpStud); if (index % 2 == 0) { studDbSet.AddStudToLab(tmpStud, labsDbset.GetById(1)); } else { studDbSet.AddStudToLab(tmpStud, labsDbset.GetById(2)); } }); }