public Tactic GetTactic(Tactic tactic) { Tactic rs = new Tactic(); using (var db = new SQLiteConnection(this.Path, this.State)) { rs = db.Query<Tactic>("SELECT * FROM Tactic WHERE ID=?", tactic.Id).FirstOrDefault(); } return rs; }
public int InsertTactic(Tactic tactic) { int rs = -1; using (var db = new SQLiteConnection(this.Path, this.State)) { db.RunInTransaction(() => { rs = db.Insert(tactic); }); } return rs; }
public int DeleteTactic(Tactic tactic) { int rs = -1; using (var db = new SQLiteConnection(this.Path, this.State)) { var existing = db.Query<Tactic>("SELECT * FROM Tactic WHERE ID=?", tactic.Id).FirstOrDefault(); if (existing != null) { db.RunInTransaction(() => { rs = db.Delete(existing); }); } } return rs; }