POSt 提交参数 实体 和字符串

时间:2023-07-10 10:00:14

//1.后台接受是 字符串形式

[HttpPost]
public int SendTaxiAudioByWX(string userid, string suid, string indexno, string filetype)
{

}

//前台参数
string url = ConfigurationManager.AppSettings["DataUrl"].ToString() + "Car/SendTaxiAudioByWX?userid=&suid=&indexno=&filetype=";

string json = CommBusiness.PostHttpData(url);
return json;

//2. 后台是实体形式

[HttpPost]
public bool AddRoadCheck(RoadCheckModel entity)
{

}

url = "http://localhost:6931/api/v2/Car/SendTaxiAudioByWX";

string param = "{\"userid\":\"" + CommBusiness.EncodeBase64(CurrentUser.userid) + "\",\"suid\":\"" + CommBusiness.EncodeBase64(suid) + "\",\"indexno\":\"" + CommBusiness.EncodeBase64(indexno) + "\",\"filetype\":\"" + CommBusiness.EncodeBase64("0") + "\"}";

string json = CommBusiness.PostHttpData(url, param);
return json;