string dd = model.Fatherid;
string serviceAddress = "http://public.data.test.cn/api/PropertyData/GetFloorBuilding";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceAddress);
request.Method = "POST";
request.ContentType = "application/json";
string strContent = @"{ ""Fatherid"": " + dd + "}";//参数
using (StreamWriter dataStream = new StreamWriter(request.GetRequestStream()))
{
dataStream.Write(strContent);//写入参数
dataStream.Close();
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string encoding = response.ContentEncoding;
if (encoding == null || encoding.Length < 1)
{
encoding = "UTF-8"; //默认编码
}
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
string retString = reader.ReadToEnd();
//JObject jo = JObject.Parse(retString);
//解析josn
GetFloorBuildingResult jo1 = JsonConvert.DeserializeObject<GetFloorBuildingResult>(retString);
return jo1;
//GetFloorBuildingResult 返回结果