标签:
public ActionResult User_Query2()
{
//通过用户手机号查寻 该用户的所有邮包记录
string User_Tel1 = Request.Form["User_Tel"];
if (User_Tel1 == null)
{
return HttpNotFound();
}
List<Parcel_info> parcel_info_List = new List<Parcel_info>();
Parcel_info d = new Parcel_info();
var parcel_info = db.Parcel_info;
var parcel_info_All = parcel_info.Where(o => o.ReceiveTel == User_Tel1);
foreach (var o in parcel_info_All)
{
d.ID =int.Parse ( o.ID.ToString());
d.ParcelNo = o.ParcelNo.ToString();
d.TargetAddress = o.TargetAddress.ToString();
d.SendTel = o.SendTel.ToString();
d.ReceiveTel = o.ReceiveTel.ToString();
}
parcel_info_List.Add(d);
if (parcel_info_List == null)
{
return HttpNotFound();
}
var jsonResult = new { total = parcel_info_List.Count, rows = parcel_info_List };
return Json(jsonResult, JsonRequestBehavior.AllowGet);
}
Entity Framework json 序列化含有导航属性的实体
标签:
原文地址:http://www.cnblogs.com/dingfangbo/p/5746803.html