示例#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);
                }
            }
        }
        // FAQ table insert update data
        public async Task InsertOrUpdateTableAsyncFAQ(FAQ f)
        {
            FAQL fAQ = new FAQL();

            fAQ.FAQ_Question = f.FAQ_Question;
            fAQ.FAQ_Anwswere = f.FAQ_Anwswere;
            if (fAQ.FAQ_ID != 0)
            {
                await CreateConnection().UpdateAsync(fAQ);
            }
            else
            {
                await CreateConnection().InsertAsync(fAQ);
            }
        }