Beispiel #1
0
        public ActionResult Xoa(int id)
        {
            FAQ_NoiDung xoaFAQ = db.FAQ_NoiDung.SingleOrDefault(n => n.Id == id);

            db.FAQ_NoiDung.Remove(xoaFAQ);
            db.SaveChanges();
            TempData["thongbao"] = "<script> $('#div-pthongbao').text('Xóa thành công !'); $('#div-thongbao').show(); $('#div-thongbao').fadeOut(5000);</script>";
            return(RedirectToAction("dsFAQ"));
        }
Beispiel #2
0
        public ActionResult ThemMoiFAQ(FAQ_NoiDung faq)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            if (ModelState.IsValid)
            {
                db.FAQ_NoiDung.Add(faq);
                db.SaveChanges();
                TempData["thongbao"] = "<script>$('#div-pthongbao').text('Tạo mới thành công !'); $('#div-thongbao').show(); $('#div-thongbao').fadeOut(5000);</script>";
            }
            return(RedirectToAction("dsFAQ"));
        }
Beispiel #3
0
        public ActionResult ChiTietFAQ(int id)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            FAQ_NoiDung seFAQ = db.FAQ_NoiDung.SingleOrDefault(n => n.Id == id);

            if (!KTNhom_FAQ(seFAQ.MaDanhMuc.Value))
            {
                return(RedirectToAction("IndexVanBan"));
            }

            return(PartialView(seFAQ));
        }
Beispiel #4
0
        public ActionResult ChinhSuaFAQ(FAQ_NoiDung faq, FormCollection f)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }


            if (ModelState.IsValid)
            {
                faq.TraLoi          = f["edTraLoi"];
                db.Entry(faq).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                TempData["thongbao"] = "<script>$('#div-pthongbao').text('Cập nhật thành công !'); $('#div-thongbao').show(); $('#div-thongbao').fadeOut(5000);</script>";
            }
            return(RedirectToAction("dsFAQ"));
        }