コード例 #1
0
        public WeixinResult UpdateProducts(IEnumerable <string> insertProducts, IEnumerable <string> deleteProducts)
        {
            WeGroupProductActionList request = new WeGroupProductActionList
            {
                GroupId = GroupId
            };

            if (insertProducts != null)
            {
                var added = from item in insertProducts
                            select new WeGroupProductAction(item, GroupAction.Add);
                request.Product.AddRange(added);
            }

            if (deleteProducts != null)
            {
                var deleted = from item in deleteProducts
                              select new WeGroupProductAction(item, GroupAction.Remove);
                request.Product.AddRange(deleted);
            }

            string url    = WeUtil.GetUrl(WeShopConst.UPDATE_GROUP_PRODUCT_URL);
            var    result = WeUtil.PostToUri(url, request.WriteJson(), new WeixinResult());

            FetchDetail();
            return(result);
        }
コード例 #2
0
        public WeixinResult UpdateProducts(IEnumerable<string> insertProducts, IEnumerable<string> deleteProducts)
        {
            WeGroupProductActionList request = new WeGroupProductActionList
            {
                GroupId = GroupId
            };

            if (insertProducts != null)
            {
                var added = from item in insertProducts
                            select new WeGroupProductAction(item, GroupAction.Add);
                request.Product.AddRange(added);
            }

            if (deleteProducts != null)
            {
                var deleted = from item in deleteProducts
                              select new WeGroupProductAction(item, GroupAction.Remove);
                request.Product.AddRange(deleted);
            }

            string url = WeUtil.GetUrl(WeShopConst.UPDATE_GROUP_PRODUCT_URL);
            var result = WeUtil.PostToUri(url, request.WriteJson(), new WeixinResult());
            FetchDetail();
            return result;
        }