Ejemplo n.º 1
0
        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"));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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" }));
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            ChuDeDAO chuDeDao = new ChuDeDAO();
            var      a        = chuDeDao.List().Count;

            Console.WriteLine(a);
        }
Ejemplo n.º 4
0
        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"));
        }
Ejemplo n.º 5
0
        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"));
                }
            }
        }
Ejemplo n.º 6
0
        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"));
                }
            }
        }