Пример #1
0
        //Thêm mới sản phẩm
        public ActionResult AddItem(int productID, int Quantity, int sizeID)
        {
            var size    = new Models.DAO.Category().SizeID(sizeID);
            var product = new ShowProduct().ProductDetail(productID);
            var Cart    = Session[CartSession];

            if (Cart != null)
            {
                var list = (List <CartItem>)Cart;

                if (list.Exists(x => x.Product.ID == productID))
                {
                    foreach (var item in list)
                    {
                        if (item.Product.ID == productID)
                        {
                            item.Quantity += Quantity;
                        }
                    }
                }
                else
                {
                    var item = new CartItem();
                    item.Product  = product;
                    item.Quantity = Quantity;
                    item.Size     = size;
                    list.Add(item);
                }

                Session[CartSession] = list;
            }
            else
            {
                var item = new CartItem();
                item.Product  = product;
                item.Quantity = Quantity;
                item.Size     = size;

                var list = new List <CartItem>();
                list.Add(item);
                Session[CartSession] = list;
            }

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public JsonResult updateSize(int sizes, int productID)
        {
            var listSize    = new Models.DAO.Category().SizeID(sizes);
            var sessionCart = (List <CartItem>)Session[CartSession];

            foreach (var item in sessionCart)
            {
                if (item.Product.ID == productID)
                {
                    item.Size = listSize;
                }
            }

            return(Json(new
            {
                status = true
            }));
        }
Пример #3
0
        //get Size
        public ActionResult listSize()
        {
            var listSize = new Models.DAO.Category().Size();

            return(PartialView(listSize));
        }
Пример #4
0
        //Get product theo Category
        public ActionResult CategoryMenu(Int32 id)
        {
            var cate = new Models.DAO.Category().MenuCate(id);

            return(PartialView(cate));
        }
Пример #5
0
        // GET: Product
        public ActionResult MenuCate()
        {
            var model = new Models.DAO.Category().Cate();

            return(PartialView(model));
        }