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" }));
                    }
                }
            }
        }
Exemple #3
0
        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"));
                }
            }
        }
Exemple #6
0
 public static void Insert(NhaXuatBanDTO NXB)
 {
     NhaXuatBanDAO.Insert(NXB);
 }
Exemple #7
0
 public static void Modify(NhaXuatBanDTO NXB)
 {
     NhaXuatBanDAO.Modify(NXB);
 }
Exemple #8
0
 public static IList GetList()
 {
     return(NhaXuatBanDAO.GetList());
 }
Exemple #9
0
 public static bool SuaNXB(NhaXuatBanDTO NXB)
 {
     return(NhaXuatBanDAO.SuaNXB(NXB));
 }
Exemple #10
0
 public static bool XoaNXB(string MaNXB)
 {
     return(NhaXuatBanDAO.XoaNXB(MaNXB));
 }
Exemple #11
0
 public static bool ThemNXB(NhaXuatBanDTO NXB)
 {
     return(NhaXuatBanDAO.ThemNXB(NXB));
 }
Exemple #12
0
 public static string GetIDNXB()
 {
     return(NhaXuatBanDAO.GetIDNXB());
 }
Exemple #13
0
 public static DataTable DanhSachNXB()
 {
     return(NhaXuatBanDAO.DanhSachNXB());
 }