public static void Save(PositionApiRequest position) { using (SQLiteConnection con = new MyTrapDB().GetConnection()) { con.Insert(position); } }
public static void Delete(int idPosition) { using (SQLiteConnection con = new MyTrapDB().GetConnection()) { PositionApiRequest position = con.Table <PositionApiRequest>().FirstOrDefault(obj => obj.Id == idPosition); con.Delete(position); } }
public static List <PositionApiRequest> GetAll() { List <PositionApiRequest> positions; using (SQLiteConnection con = new MyTrapDB().GetConnection()) { positions = con.Table <PositionApiRequest>().ToList(); } return(positions); }
public static Preference GetByKey(string key) { Preference result; using (SQLiteConnection con = new MyTrapDB().GetConnection()) { result = con.Table <Preference>().FirstOrDefault(obj => obj.Key == key); } return(result); }
public static void Save(string key, string value) { Preference preference = GetByKey(key); using (SQLiteConnection con = new MyTrapDB().GetConnection()) { if (preference != null) { preference.Value = value; con.Update(preference); } else { preference = new Preference() { Key = key, Value = value }; con.Insert(preference); } } }