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 void DeleteArchQuestions(ArchQuestion question) { context.Set <ArchQuestion>().Remove(question); }
public void EditArchQuestion(ArchQuestion question) { context.Entry <ArchQuestion>(question).CurrentValues.SetValues(question); }
public void CreateArchQuestion(ArchQuestion question) { context.Set <ArchQuestion>().Add(question); }