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")); }
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")); }
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)); }
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")); }