예제 #1
0
        public JsonResult AddProduct(string pid)
        {
            AddToCartBean aBean = new AddToCartBean();

            aBean.pid = pid;
            AddToCart.AddCart(aBean);
            return(Json(AddToCart.getCartNumberofItem(), JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public static List <AddToCartBean> AddCart(AddToCartBean addItem)
        {
            Page page = new Page();
            List <AddToCartBean> aBeanList = null;

            try
            {
                aBeanList = (List <AddToCartBean>)page.Session["AddList"];
                if (aBeanList == null)
                {
                    aBeanList = new List <AddToCartBean>();
                }

                if (!aBeanList.Contains(addItem))
                {
                    if (!aBeanList.Equals(addItem))
                    {
                        addItem.TotalPrice = addItem.ProductQty * addItem.ProductPrice;
                        aBeanList.Add(addItem);
                    }
                }
                page.Session["AddList"] = aBeanList;
            }
            catch
            {
                if (!aBeanList.Contains(addItem))
                {
                    if (!aBeanList.Equals(addItem))
                    {
                        addItem.TotalPrice = addItem.ProductQty * addItem.ProductPrice;
                        aBeanList.Add(addItem);
                    }
                }
                page.Session["AddList"] = aBeanList;
            }
            return(aBeanList);
        }