public ActionResult Delete(long idNXB) { 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 NhaXuatBanDAO(); bool rs = db.DeleteNXB(idNXB); if (rs == false) { ViewBag.Err = "Vẫn còn sách thuộc nhà xuất bản này"; return(View("Index")); } else { Session["UpdateNXB"] = null; return(View("Index")); } } } }
public ActionResult Index(NhaXuatBan nxb, string moTa, HttpPostedFileBase file) { 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["UpdateNXB"] == null) { var db = new NhaXuatBanDAO(); db.InsertNXB(nxb, moTa, file); Session["ListNXB"] = null; return(RedirectToAction("Reset", "NhaXuatBan", new { area = "Admin" })); } else { var db = new NhaXuatBanDAO(); var nxb1 = Session["UpdateNXB"] as NhaXuatBan; db.UpdateNXB(nxb1.IdNXB, nxb, moTa, file); Session["UpdateNXB"] = null; Session["ListNXB"] = null; return(RedirectToAction("Reset", "NhaXuatBan", new { area = "Admin" })); } } } }
public NhaXuatBanDTO LayTenNhaXuatBan(int maNXB) { NhaXuatBanDAO nxbDAO = new NhaXuatBanDAO(); NhaXuatBanDTO nxbDTO = null; nxbDTO = nxbDAO.LayTenNhaXuatBan(maNXB); return(nxbDTO); }
public ActionResult Update(long idNXB) { 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 NhaXuatBanDAO(); Session["UpdateNXB"] = db.Find(idNXB); return(View("Index")); } } }
public ActionResult Search(string tenNXB) { 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 NhaXuatBanDAO(); Session["ListNXB"] = db.Search(tenNXB); return(View("Index")); } } }
public static void Insert(NhaXuatBanDTO NXB) { NhaXuatBanDAO.Insert(NXB); }
public static void Modify(NhaXuatBanDTO NXB) { NhaXuatBanDAO.Modify(NXB); }
public static IList GetList() { return(NhaXuatBanDAO.GetList()); }
public static bool SuaNXB(NhaXuatBanDTO NXB) { return(NhaXuatBanDAO.SuaNXB(NXB)); }
public static bool XoaNXB(string MaNXB) { return(NhaXuatBanDAO.XoaNXB(MaNXB)); }
public static bool ThemNXB(NhaXuatBanDTO NXB) { return(NhaXuatBanDAO.ThemNXB(NXB)); }
public static string GetIDNXB() { return(NhaXuatBanDAO.GetIDNXB()); }
public static DataTable DanhSachNXB() { return(NhaXuatBanDAO.DanhSachNXB()); }