/// <summary> /// ���һ����Ʒ���ݹ�Ӧ��ID��ʹ��Post(json) /// </summary> /// <param name="providerid"></param> /// <param name="PdName"></param> /// <param name="ProductDescribe"></param> /// <returns></returns> public ResponseMsg AddProduct(Guid providerid, string PdName, string ProductDescribe,float price,int num) { ProductInfo productInfo = new ProductInfo { PdNum = num, PdPrice = price, PdName = PdName, ProductDescribe = ProductDescribe }; Cf_HttpWeb _httpweb = new Cf_HttpWeb { ContentType = "text/html", UserDate = JsonConvert.SerializeObject(productInfo) }; _httpweb.EncodingSet = "utf-8"; string url = string.Format("http://localhost:32839/api/restful/ProductInfo/AddProduct/{0}", providerid.ToString()); string str = _httpweb.PostOrGet(url, HttpMethod.POST).HtmlValue; return JsonConvert.DeserializeObject<ResponseMsg>(str); }
/// <summary> /// ����json������ /// </summary> /// <returns></returns> public ResponseMsg UpdataProduct(Guid pdid, string pdName, double pdPrice, string productDescribe, int pdNum) { ProductInfo productInfo = new ProductInfo { PdId = pdid, PdName = pdName, PdPrice = pdPrice, ProductDescribe = productDescribe, PdNum = pdNum }; Cf_HttpWeb _httpweb = new Cf_HttpWeb { ContentType = "text/html", UserDate = JsonConvert.SerializeObject(productInfo) }; _httpweb.EncodingSet = "utf-8"; string url = "http://localhost:32839/api/restful/ProductInfo/UpdataProduct"; string str = _httpweb.PostOrGet(url, HttpMethod.POST).HtmlValue; return JsonConvert.DeserializeObject<ResponseMsg>(str); }