public ActionResult Delete(long idChuDe) { var tk = Session["TaiKhoan"] as KhachHang; if (tk == null) { return(View("../Login/Index")); } else { if (tk.LoaiTK != "Admin") { return(View("../Home/Index")); } else { var db = new ChuDeDAO(); bool rs = db.DeleteCD(idChuDe); if (rs == false) { ViewBag.Err = "Vẫn còn sách thuộc chủ đề này"; return(View("Index")); } else { Session["UpdateCD"] = null; return(View("Index")); } } } }
public ActionResult Index(ChuDe cd) { var tk = Session["TaiKhoan"] as KhachHang; if (tk == null) { return(View("../Login/Index")); } else { if (tk.LoaiTK != "Admin") { return(View("../Home/Index")); } else { if (Session["UpdateCD"] == null) { var db = new ChuDeDAO(); db.InsertCD(cd); Session["ListCD"] = null; return(RedirectToAction("Reset", "ChuDe", new { area = "Admin" })); } else { var dao = new ChuDeDAO(); var cd1 = Session["UpdateCD"] as ChuDe; dao.UpdateCD(cd1.IdChuDe, cd); Session["UpdateCD"] = null; Session["ListCD"] = null; return(RedirectToAction("Reset", "ChuDe", new { area = "Admin" })); } } } }
public static void Main(string[] args) { ChuDeDAO chuDeDao = new ChuDeDAO(); var a = chuDeDao.List().Count; Console.WriteLine(a); }
public ActionResult ChuDe(long idCD) { var cd = new ChuDeDAO(); Session["Title"] = cd.Find(idCD).Ten; var sach = new SachDAO(); Session["Products"] = sach.GetListCD(idCD); return(View("../DanhSachSanPham/Index")); }
public ActionResult Search(string tenCD, string xuatXu) { var tk = Session["TaiKhoan"] as KhachHang; if (tk == null) { return(View("../Login/Index")); } else { if (tk.LoaiTK != "Admin") { return(View("../Home/Index")); } else { var db = new ChuDeDAO(); Session["ListCD"] = db.Search(tenCD, xuatXu); return(View("Index")); } } }
public ActionResult Update(long idChuDe) { var tk = Session["TaiKhoan"] as KhachHang; if (tk == null) { return(View("../Login/Index")); } else { if (tk.LoaiTK != "Admin") { return(View("../Home/Index")); } else { var db = new ChuDeDAO(); Session["UpdateCD"] = db.Find(idChuDe); return(View("Index")); } } }