Ejemplo n.º 1
0
        static string TABLE_NAME = "DbConns"; //table name

        /// <summary>
        /// Insert
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Insert(DbConnConfig model)
        {
            // Open database (or create if not exits)
            using (var db = new LiteDatabase(LocalConfig.SettingDataFileName))
            {
                // Get DbConnection collection
                var col = db.GetCollection <DbConnConfig>(TABLE_NAME);
                model.IsActive = true;

                var value = col.Insert(model);
                return(value.AsInt32);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(DbConnConfig model)
 {
     return(LiteDBHelper <DbConnConfig> .Update(LocalConfig.SettingDataFileName, model, TABLE_NAME));
 }