哼哼

private static readonly Uri address = new Uri("http://localhost:55242/");
public ActionResult Show(int PageIdex = 1)
{
string name = Request["txtName"];
int ptype = Convert.ToInt32(Request["selectType"] == null ? "0" : Request["selectType"]);
Uri url = new Uri(address, "/UseApi/Beijing/Getlist?name=" + name + "&Tid=" + ptype + "");

HttpClient httpClient = new HttpClient();

var res = httpClient.GetAsync(url).Result;

var str = "";

if (res.IsSuccessStatusCode)
{
str = res.Content.ReadAsStringAsync().Result;
}

var da = JsonConvert.DeserializeObject<List<Us>>(str);

var daList = da.ToPagedList<Us>(PageIdex, 3);

return View(daList);
}

原文地址:https://www.cnblogs.com/w-pengchao/p/7883671.html