Exemplo n.º 1
0
        private void dtgLoaiTL_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            loai               = listLoai[dtgLoaiTL.SelectedIndex];
            txtTenLoai.Text    = loai.ten_loai;;
            txtGhiChuLoai.Text = loai.ghichu;

            btnSuaLoai.IsEnabled = true;
            btnXoaLoai.IsEnabled = true;
        }
Exemplo n.º 2
0
        public ActionResult Xoa(int id)
        {
            LoaiTaiLieu xoaLoaiTL = db.LoaiTaiLieux.SingleOrDefault(n => n.MaLoaiTL == id);

            db.LoaiTaiLieux.Remove(xoaLoaiTL);
            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"));
        }
Exemplo n.º 3
0
        public ActionResult ChinhSua(LoaiTaiLieu loaitl)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            if (ModelState.IsValid)
            {
                db.Entry(loaitl).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"));
        }
Exemplo n.º 4
0
        public ActionResult ThemMoi(LoaiTaiLieu loaitl)
        {
            if (KiemTraSession() == true)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            if (ModelState.IsValid)
            {
                db.LoaiTaiLieux.Add(loaitl);
                db.SaveChanges();
                TempData["thongbao"] = "<script> $('#div-pthongbao').text('Tạo loại văn bản thành công !'); $('#div-thongbao').show(); $('#div-thongbao').fadeOut(5000);</script>";
            }
            return(RedirectToAction("DanhSach"));
        }