Exemple #1
0
 public bool fUpdateFaq(mFaq pFaq)
 {
     try
     {
         tbl_faq c = new tbl_faq();
         c.faq_id       = pFaq.faq_id;
         c.faq_answer   = pFaq.faq_answer;
         c.faq_exp      = pFaq.faq_exp;
         c.faq_question = pFaq.faq_question;
         Db.tbl_faq.Attach(c);
         Db.Entry(c).State = System.Data.Entity.EntityState.Modified;
         return(Convert.ToBoolean(Db.SaveChanges()));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #2
0
 public bool InsertFaq(mFaq pCat)
 {
     try
     {
         tbl_faq vFaq  = new tbl_faq();
         var     query = from b in Db.tbl_faq
                         orderby b.faq_id descending
                         select b;
         vFaq = query.FirstOrDefault();
         tbl_faq c = new tbl_faq();
         c.faq_answer      = pCat.faq_answer;
         c.faq_exp         = pCat.faq_exp;
         c.faq_question    = pCat.faq_question;
         c.faq_question_en = pCat.faq_question_en;
         c.faq_answer_en   = pCat.faq_answer_en;
         c.faq_id          = vFaq.faq_id + 1;
         Db.tbl_faq.Add(c);
         return(Convert.ToBoolean(Db.SaveChanges()));
     }
     catch (Exception)
     {
         return(false);
     }
 }