示例#1
0
        public ActionResult KichHoat(int id, bool id2)
        {
            DMPhongBan dmPhongBam = db.DMPhongBans.SingleOrDefault(n => n.Id == id);

            dmPhongBam.KichHoat = id2;
            db.SaveChanges();
            return(RedirectToAction("DanhSach"));
        }
示例#2
0
        public ActionResult Xoa(int id)
        {
            DMPhongBan xoaPhong = db.DMPhongBans.SingleOrDefault(n => n.Id == id);

            db.DMPhongBans.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"));
        }
示例#3
0
        public ActionResult Xoa(int id)
        {
            DMPhongBan xoaPhong = db.DMPhongBans.SingleOrDefault(n => n.Id == id);

            db.DMPhongBans.Remove(xoaPhong);
            db.SaveChanges();
            TempData["thongbao"] = "<script> $('#btn-dongy').hide(); $('#pthongbao').text('Xóa thành công'); $('#btn-thongbao').trigger('click');</script>";
            return(RedirectToAction("DanhSach"));
        }
示例#4
0
        public ActionResult ThemMoi(DMPhongBan pb)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            if (ModelState.IsValid)
            {
                db.DMPhongBans.Add(pb);
                db.SaveChanges();
                TempData["thongbao"] = "<script> $('#btn-dongy').hide(); $('#pthongbao').text('Tạo mới thành công'); $('#btn-thongbao').trigger('click');</script>";
            }
            return(RedirectToAction("DanhSach"));
        }
示例#5
0
        public ActionResult ChinhSua(DMPhongBan pb)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }


            if (ModelState.IsValid)
            {
                db.Entry(pb).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                TempData["thongbao"] = "<script> $('#btn-dongy').hide(); $('#pthongbao').text('Cập nhật thành công'); $('#btn-thongbao').trigger('click');</script>";
            }
            return(RedirectToAction("DanhSach"));
        }
示例#6
0
        public ActionResult ThemMoi(DMPhongBan pb)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            if (ModelState.IsValid)
            {
                if (pb.KichHoat == null)
                {
                    pb.KichHoat = false;
                }
                db.DMPhongBans.Add(pb);
                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"));
        }
示例#7
0
        public ActionResult ChinhSua(DMPhongBan pb)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }


            if (ModelState.IsValid)
            {
                if (pb.KichHoat == null)
                {
                    pb.KichHoat = false;
                }
                db.Entry(pb).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"));
        }