json to entity in api

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

上一篇:python 3.5.2安装mysql驱动报错


下一篇:UI相关教程:HUD、UMG和Widget