public static void Edit(AdminFAQModel Banner)
 {
     //dbFirstStepDataContext db = new dbFirstStepDataContext();
     //EntityFAQ Faq = db.EntityFAQs.Where(p => p.Id == Banner.Id).First();
     //Faq.TieuDe = Banner.TieuDe;
     //Faq.Loai = Banner.Loai;
     //Faq.NoiDung = Banner.NoiDung;
     //Faq.ViTri = Banner.ViTri;
     //Faq.IdRoot = Banner.IdRoot;
     //db.SubmitChanges();
 }
 public static AdminFAQModel LayModelFAQ(int Id)
 {
     AdminFAQModel Ban = new AdminFAQModel();
     dbFirstStepDataContext db = new dbFirstStepDataContext();
     EntityFAQ1 tnew = db.EntityFAQ1s.Where(p => p.Id == Id).First();
     Ban.Id = tnew.Id;
     Ban.CauHoi = tnew.CauHoi;
     Ban.CauTraLoi = tnew.CauTraLoi;
     Ban.IdGroupFAQ = tnew.IdGroupFAQ;
     Ban.ViTri = tnew.ViTri;
     Ban.Type = 2;
     return Ban;
 }
 public static AdminFAQModel LayModelGroup(int Id)
 {
     AdminFAQModel Ban = new AdminFAQModel();
     dbFirstStepDataContext db = new dbFirstStepDataContext();
     EntityGroupFAQ tnew = db.EntityGroupFAQs.Where(p => p.Id == Id).First();
     Ban.Id = tnew.Id;
     Ban.TenGroup = tnew.TenGroup;
     Ban.IdGroupFAQ = tnew.IdGroupFAQ;
     Ban.IdLoaiFAQ = tnew.IdLoaiFAQ;
     Ban.ViTri = tnew.ViTri;
     Ban.Type = 1;
     return Ban;
 }
 public ActionResult InsertTongHop(AdminFAQModel DM)
 {
     try
     {
         // dbFirstStepDataContext db = new dbFirstStepDataContext();
         if (DM.Type == 1)
         {
             EntityGroupFAQ ban = new EntityGroupFAQ();
             ban.TenGroup = DM.TenGroup;
             ban.ViTri = DM.ViTri;
             ban.IdGroupFAQ = DM.IdGroupFAQ;
             db.EntityGroupFAQs.InsertOnSubmit(ban);
             db.SubmitChanges();
         }
         else
         {
             EntityFAQ1 ban = new EntityFAQ1();
             ban.CauHoi = DM.CauHoi;
             ban.CauTraLoi = DM.CauTraLoi;
             ban.ViTri = DM.ViTri;
             ban.IdGroupFAQ = DM.IdGroupFAQ;
             db.EntityFAQ1s.InsertOnSubmit(ban);
             db.SubmitChanges();
         }
         return RedirectToAction("DanhSachTongHop", "AdminFAQ", new { IdGroupFAQ = DM.IdGroupFAQ });
     }
     catch
     {
         return RedirectToAction("Index", "Error");
     }
 }
 public ActionResult InsertTongHop(int IdGroupFAQ)
 {
     AdminFAQModel tnew = new AdminFAQModel();
     ViewBag.IdGroupFAQ = IdGroupFAQ;
     tnew.Type = 1;
     //dbFirstStepDataContext db = new dbFirstStepDataContext();
     return View(tnew);
 }