哼哼

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);
}

posted @ 2017-11-23 10:43  嗯哼,还好  阅读(148)  评论(0)    收藏  举报