예제 #1
0
        public String AddCart(Cart carts)
        {
            int     goodid    = int.Parse(Request["goodsid"]);
            decimal price     = decimal.Parse(Request["price"].ToString());
            int     userid    = int.Parse(Session["User_id"].ToString());
            int     num       = int.Parse(Request["Jm_Amount"]);
            var     goodscart = CartManage.Findgoodscart(userid, goodid);

            if (goodscart >= 1)
            {
                var usergoods = CartManage.findsusergoodcart(userid, goodid);
                usergoods.CartCount = usergoods.CartCount + num;
                usergoods.Total     = price * usergoods.CartCount;
                CartManage.Update(usergoods);
                return("ok");
            }
            else
            {
                carts.User_id   = userid;
                carts.Goods_id  = goodid;
                carts.Price     = price;
                carts.CartCount = num;
                carts.Total     = price * num;
                CartManage.AddCart(carts);
                return("ok");
            }
        }
예제 #2
0
        public string updatetotal(int id)
        {
            var cartss = CartManage.findcartid(id);

            if (cartss != null)
            {
                cartss.Flog = true;
                CartManage.Update(cartss);
                return("success");
            }
            else
            {
                return("fail");
            }
        }
예제 #3
0
        public string updatecart(int id, string num)
        {
            var number = Convert.ToInt32(num);
            var cartss = CartManage.findcartid(id);

            if (cartss != null)
            {
                cartss.CartCount = number;
                cartss.Total     = decimal.Parse((number * cartss.Price).ToString());
                CartManage.Update(cartss);

                return("success");
            }
            else
            {
                return("fail");
            }
        }