public static void CheckStudentExerciseTable() { SqliteConnection db = DatabaseInterface.Connection; Console.WriteLine("Running Student Excercise Test"); try { List <StudentExercise> studentExercises = db.Query <StudentExercise> ("SELECT Id FROM StudentExercise").ToList(); } catch (System.Exception ex) { if (ex.Message.Contains("no such table")) { StudentExercise.Create(db); Console.WriteLine("About to Seed Student Excercise"); StudentExercise.Seed(db); } } }
public static void CheckStudentExerciseTable() { SqliteConnection db = DatabaseInterface.Connection; try { List <StudentExercise> studentExercise = db.Query <StudentExercise> ("SELECT Id FROM StudentExercise").ToList(); } catch (System.Exception ex) { if (ex.Message.Contains("no such table")) { StudentExercise.Create(db); db.Execute(@" INSERT INTO StudentExercise SELECT null, e.Id, 1, 1 FROM Exercise e WHERE e.Name = 'Nutshell' "); db.Execute(@" INSERT INTO StudentExercise SELECT null, e.Id, 2, 1 FROM Exercise e WHERE e.Name = 'Nutshell' "); db.Execute(@" INSERT INTO StudentExercise SELECT null, e.Id, 5, 2 FROM Exercise e WHERE e.Name = 'Dream Team' "); db.Execute(@" INSERT INTO StudentExercise SELECT null, e.Id, 4, 2 FROM Exercise e WHERE e.Name = 'Nutshell' "); db.Execute(@" INSERT INTO StudentExercise SELECT null, e.Id, 5, 3 FROM Exercise e WHERE e.Name = 'Nutshell' "); db.Execute(@" INSERT INTO StudentExercise SELECT null, e.Id, 3, 3 FROM Exercise e WHERE e.Name = 'Dynamic Cards' "); } } }