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