Beispiel #1
0
        /// <summary>
        /// 编辑购物车
        /// </summary>
        /// <param name="Cartid"></param>
        /// <param name="CartNum"></param>
        /// <returns></returns>
        public string UpdateCartNum(string Cartid, int CartNum)
        {
            string strJson = "";

            Entity.BaseDataResponse Response      = new Entity.BaseDataResponse();
            BLL.shop_cart           shop_cart_BLL = new shop_cart();

            try
            {
                if (CartNum == 0)
                {
                    shop_cart_BLL.DeleteByCartid(Cartid);
                }
                else
                {
                    shop_cart_BLL.UpdateCartNum(Cartid, CartNum);
                }

                Response.Result = true;
                Response.Msg    = "";
            }
            catch (Exception ex)
            {
                string r = ex.ToString();
                Response.Result = false;
                Response.Msg    = "数据异常!";
            }
            strJson = Newtonsoft.Json.JsonConvert.SerializeObject(Response);
            return(strJson);
        }
Beispiel #2
0
        /// <summary>
        /// 展示用户购物车列表
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public string GetListByUserid(string UserId)
        {
            string strJson = "";

            Entity.DataResponse_shop_cart Response = new Entity.DataResponse_shop_cart();
            BLL.shop_cart shop_cart_BLL            = new shop_cart();

            try
            {
                Response.List   = shop_cart_BLL.GetListByUserid(UserId);
                Response.Result = true;
                Response.Msg    = "";
            }
            catch (Exception ex)
            {
                string r = ex.ToString();
                Response.Result = false;
                Response.Msg    = "数据异常!";
            }
            strJson = Newtonsoft.Json.JsonConvert.SerializeObject(Response);
            return(strJson);
        }
Beispiel #3
0
        /// <summary>
        /// 添加购物车
        /// </summary>
        /// <param name="MJson"></param>
        /// <returns></returns>
        public string AddCart(string MJson)
        {
            string strJson = "";

            Entity.BaseDataResponse Response      = new Entity.BaseDataResponse();
            BLL.shop_cart           shop_cart_BLL = new shop_cart();

            try
            {
                Entity.shop_cart model = Newtonsoft.Json.JsonConvert.DeserializeObject <Entity.shop_cart>(MJson);
                shop_cart_BLL.Add(model);
                Response.Result = true;
                Response.Msg    = "";
            }
            catch (Exception ex)
            {
                string r = ex.ToString();
                Response.Result = false;
                Response.Msg    = "数据异常!";
            }
            strJson = Newtonsoft.Json.JsonConvert.SerializeObject(Response);
            return(strJson);
        }