Beispiel #1
0
        // FAQ table insert update data
        public async Task InsertOrUpdateTableAsyncFAQ(FAQ f)
        {
            FAQL       fAQ = new FAQL();
            SQLiteDB   db  = new SQLiteDB();
            List <FAQ> fdb = new List <FAQ>();

            fdb = db.GetItemAsyncFAQ().Result;
            fAQ.FAQ_Question = f.FAQ_Question;
            fAQ.FAQ_Anwswere = f.FAQ_Anwswere;
            bool dupe = false;

            //check for duplicates
            foreach (var a in fdb)
            {
                if ((a.FAQ_Question == f.FAQ_Question) && (a.FAQ_Anwswere == f.FAQ_Anwswere))
                {
                    dupe = true;
                }
            }
            //update/insert if not a duplicate
            if (dupe == false)
            {
                if (fAQ.FAQ_ID != 0)
                {
                    await CreateConnection().UpdateAsync(fAQ);
                }
                else
                {
                    await CreateConnection().InsertAsync(fAQ);
                }
            }
        }
Beispiel #2
0
        async Task <List <DBs.FAQ> > GetDB()
        {
            SQLiteDB dbcon = new SQLiteDB();

            return(await dbcon.GetItemAsyncFAQ());
        }