using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xinleda.Common;
using Xinleda.Model;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HttpClient client = new HttpClient();
FormUrlEncodedContent content = new FormUrlEncodedContent(
new List<KeyValuePair<string, string>>() {
new KeyValuePair<string, string>("batdata[0].id", "213"),
new KeyValuePair<string, string> ("token","qwe") });
var result = client.PostAsync("http://localhost:55787/api/XldSalary/Update", content).Result.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
Console.ReadKey();
}
}
}
UploadPaydataModel model = new Xinleda.Model.UploadPaydataModel();
model.entrname = "上海有限公司";
model.batdata = new List<batdata>() { new batdata() { bank = "名还是呢过" } };
var content = SerializerHelper.JsonSerialize(model);
WebRequest request = HttpWebRequest.Create("http://localhost:55787/api/XldSalary/Update");
request.ContentType = "application/json";
request.Method = "post";
using (StreamWriter sw = new StreamWriter(request.GetRequestStream()))
{
sw.Write(content);
sw.Close();
}
WebResponse r = request.GetResponse();
string result = "";
using (StreamReader sr = new StreamReader(r.GetResponseStream()))
{
result = sr.ReadToEnd();
sr.Close();
}
Console.WriteLine(result);
Console.ReadKey();
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。