Пример #1
0
        // GET: Cart
        public ActionResult Index()
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            return(View());
        }
Пример #2
0
        // GET: ChiTietSanPham/Details/5
        public ActionResult Details(int id)
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            return(View(db.Giays.Where(item => item.shoeId == id).SingleOrDefault()));
        }
Пример #3
0
        public ActionResult Them()
        {
            var dm = new DanhMucDAO();

            ViewBag.Categories = dm.GetAll();
            return(View("Them"));
        }
Пример #4
0
        public ActionResult Edit(int id)
        {
            KhachHangDAO khDAO = new KhachHangDAO();
            DanhMucDAO   dm    = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            return(View(khDAO.getUserById(id)));
        }
Пример #5
0
        public ActionResult Sua(int id)
        {
            SanPham entity = SanPhamDAO.getShoeById(id);
            var     dm     = new DanhMucDAO();

            ViewBag.Categories = dm.GetAll();
            return(View(entity));
        }
        // GET: HangKhuyenMai
        public ActionResult Index(int?page)
        {
            int        pageSize   = 10;
            int        pageNumber = page ?? 1;
            DanhMucDAO dm         = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            var list = db.SanPhams.Where(item => item.comparePrice > item.price).ToList().ToPagedList(pageNumber, pageSize);

            return(PartialView(list));
        }
Пример #7
0
        public ActionResult MyAccount()
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            var userId = System.Web.HttpContext.Current.Session["USER_ID"];

            if (userId != null)
            {
                var kh = db.KhachHangs.ToList().Where(item => item.userId == Convert.ToInt32(userId)).SingleOrDefault();
                return(View(kh));
            }
            return(RedirectToAction("Index"));
        }
Пример #8
0
        public ActionResult KiemTraDonHang()
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            var userId = Convert.ToInt32(System.Web.HttpContext.Current.Session["USER_ID"]);
            var dh     = db.DonHangs.Where(donhang => donhang.userId == userId).Select(item => new DonHangViewModel()
            {
                address    = item.address,
                createdAt  = item.createdAt,
                orderId    = item.orderId,
                status     = item.status,
                totalMoney = db.ChiTietDonHangs.Where(i => i.orderId == item.orderId).Sum(i => i.price * i.quantity)
            }).ToList();

            return(View(dh));
        }
        public ActionResult Shop(int?page, string currentFilter, string size = "all", string price = "0", string filterType = "all", string sortOrder = "option", string sortActive = "Tùy chọn")
        {
            DanhMucDAO dm = new DanhMucDAO();
            SanPhamDAO x  = new SanPhamDAO();

            ViewBag.danhMuc    = dm.GetAll().ToList();
            ViewBag.price      = price.ToString();
            ViewBag.filterType = filterType;
            ViewBag.action     = "Shop";
            ViewBag.title      = "Shop";
            ViewBag.size       = size;
            ViewBag.sortOrder  = sortOrder;
            ViewBag.sortActive = sortActive;
            int pageSize   = 4;
            int pageNumber = page ?? 1;

            return(View(x.GetAll().ToPagedList(pageNumber, pageSize)));
        }
Пример #10
0
        public ActionResult GiayNam(int?page, string currentFilter, string size = "all", string price = "0", string filterType = "all", string sortOrder = "option", string sortActive = "Tùy chọn")
        {
            DanhMucDAO dm = new DanhMucDAO();
            GiayDAO    x  = new GiayDAO();

            ViewBag.danhMuc    = dm.GetAll().ToList();
            ViewBag.price      = price.ToString();
            ViewBag.filterType = filterType;
            ViewBag.action     = "GiayNam";
            ViewBag.title      = "Giày nam";
            ViewBag.size       = size;
            ViewBag.sortOrder  = sortOrder;
            ViewBag.sortActive = sortActive;
            int pageSize   = 4;
            int pageNumber = page ?? 1;

            return(View(x.getProductsMale(size, price, filterType, sortOrder).ToPagedList(pageNumber, pageSize)));
        }
Пример #11
0
        // GET: Account
        public ActionResult Index(bool?isLogout)
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            if (isLogout == true)
            {
                System.Web.HttpContext.Current.Session.Clear();
            }
            else
            {
                var userId = System.Web.HttpContext.Current.Session["USER_ID"];
                if (userId != null)
                {
                    var kh = db.KhachHangs.ToList().Where(item => item.userId == Convert.ToInt32(userId)).SingleOrDefault();
                    return(RedirectToAction("MyAccount"));
                }
            }

            return(View());
        }
        public ActionResult TheLoai(int?page, int?id, string typeMaleorFemale, string categoryName, string price = "0", string filterType = "all", string size = "all", string sortOrder = "option", string sortActive = "Tùy chọn")
        {
            SanPhamDAO g  = new SanPhamDAO();
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            ViewBag.filterTypeMaleorFemale = typeMaleorFemale;
            ViewBag.filterType             = filterType;
            ViewBag.action     = "TheLoai";
            ViewBag.price      = price.ToString();
            ViewBag.title      = categoryName;
            ViewBag.size       = size;
            ViewBag.sortActive = sortActive;
            ViewBag.sortOrder  = sortOrder;
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            int pageSize   = 3;
            int pageNumber = page ?? 1;

            return(View("TheLoai", g.GetProductsBaseCategoryId(id ?? 0, typeMaleorFemale, price, filterType, size, sortOrder).ToPagedList(pageNumber, pageSize)));
        }
Пример #13
0
        public ActionResult Register(KhachHang kh)
        {
            DanhMucDAO dm = new DanhMucDAO();

            ViewBag.danhMuc = dm.GetAll().ToList();
            if (ModelState.IsValid)
            {
                var khachHangDDAO = new KhachHangDAO();
                var pw            = Encryptor.MD5Hash(kh.password);
                var cfpw          = Encryptor.MD5Hash(kh.confirmPassword);
                kh.password        = pw;
                kh.confirmPassword = cfpw;
                var res = khachHangDDAO.them(kh);
                if (res)
                {
                    ViewBag.Message = "Thêm khách hàng thành công";
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError("", "Email đã tồn tại. Vui lòng chọn email khác!");
                return(View());
            }
            return(View());
        }
Пример #14
0
 // GET: Admin/DanhMuc
 public ActionResult Index()
 {
     return(View(categoryDAO.GetAll()));
 }