public ActionResult KichHoat(int id, bool id2) { PhongHop dmPhong = db.PhongHops.SingleOrDefault(n => n.Id == id); dmPhong.Status = id2; db.SaveChanges(); return(RedirectToAction("DanhSach")); }
public ActionResult Xoa(int id) { PhongHop xoaPhong = db.PhongHops.SingleOrDefault(n => n.Id == id); db.PhongHops.Remove(xoaPhong); db.SaveChanges(); TempData["thongbao"] = "<script> $('#div-pthongbao').text('Xóa thành công !'); $('#div-thongbao').show(); $('#div-thongbao').fadeOut(5000);</script>"; return(RedirectToAction("DanhSach")); }
public ActionResult ThemMoi(PhongHop ph) { if (KiemTraSession() == true) { return(RedirectToAction("DangNhap", "QuanTri")); } if (ModelState.IsValid) { if (ph.Status == null) { ph.Status = false; } db.PhongHops.Add(ph); 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("DanhSach")); }
public ActionResult ChinhSua(PhongHop ph) { if (KiemTraSession() == true) { return(RedirectToAction("DangNhap", "QuanTri")); } if (ModelState.IsValid) { if (ph.Status == null) { ph.Status = false; } db.Entry(ph).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("DanhSach")); }