码迷,mamicode.com
首页 > Windows程序 > 详细

json to entity in api

时间:2015-05-25 21:58:21      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

using (var client = new HttpClient())
{
var WVMId = DB.Vehicles.Where(v => v.Id == new Guid(vehicleId)).Select(v => v.WVMID).FirstOrDefault();
var reqUrl = baseUrl + url;
var respurl = string.Format(reqUrl, WVMId);
var response = client.GetStringAsync(respurl).Result;
var json = JArray.Parse(response);
foreach (var temp in json)
{
var model = temp.ToObject(typeof(VehicleMaintenanceItemData), new Newtonsoft.Json.JsonSerializer()) as VehicleMaintenanceItemData;
maintenanceItems.Add(model);
}
return maintenanceItems;
}

json to entity in api

标签:

原文地址:http://www.cnblogs.com/tomahawk/p/4528730.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!