void LoadOpleidingen(SqliteConnection conn) { bool shouldClose = false; // Is the database already open? if (conn.State != ConnectionState.Open) { shouldClose = true; conn.Open(); } // Execute query using (var command = conn.CreateCommand()) { try { // Create new command command.CommandText = "SELECT DISTINCT ID FROM [Opleiding]"; using (var reader = command.ExecuteReader()) { while (reader.Read()) { var opleiding = new OpleidingModel(); var id = (string)reader["ID"]; opleiding.Load(conn, id); //AddPersoon(persoon); Opleidingen.Add(opleiding); } } } catch (Exception Exception) { Debug.WriteLine(Exception.Message); } } if (shouldClose) { conn.Close(); } }
public bool AddOpleiding(OpleidingModel _opleiding) { Opleidingen.Add(_opleiding); return(true); }