public void SaveArchQuestionsForTest(List <Tuple <Question, int> > archiveList) { List <ArchQuestion> archQuestion = ArchiveConverter.AddArchiveQuestions(archiveList); foreach (ArchQuestion a in archQuestion) { if (!GetAllArchQuestions().Exists(q => q.RefQuestion == a.RefQuestion)) { CreateArchQuestion(a); } else { ArchQuestion arch = GetAllArchQuestions().FirstOrDefault(q => q.RefQuestion == a.RefQuestion); arch.Repeat = a.Repeat; EditArchQuestion(arch); } SaveChanges(); } }
public List <Tuple <Question, int> > GetArchQuestionsForTest(int testId) { return(ArchiveConverter.GetArchiveQuestions(GetAllArchQuestions().Where(q => q.RefTest.Equals(testId)).ToList())); }