Example #1
0
        public ActionResult ChiTietKhuyenMai(long id)
        {
            var km = new KhuyenMaiDAO();

            Session["KM"] = km.Find(id);
            var sach = new SachDAO();

            Session["Title"]    = km.Find(id).TenKhuyenMai;
            Session["Products"] = sach.GetListKM(id);
            return(View("../DanhSachSanPham/Index"));
        }
        public void FindTest()// so sanh ten
        {
            KhuyenMai test = new KhuyenMai();

            test.TenKhuyenMai = "KMtest25";
            Assert.AreEqual(test.TenKhuyenMai, dao.Find(5).TenKhuyenMai);
        }
        public ActionResult Update(long idKM)
        {
            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 KhuyenMaiDAO();
                    Session["UpdateKM"] = db.Find(idKM);
                    return(View("Index"));
                }
            }
        }