我有以下实体
实体资产管理
public class AssetMgmt : CommonPropertiesViewModel
{
public int DepartmentId { get; set; }
public int TypeOfDevice { get; set; }
public string DeviceStatus { get; set; }
public test[] Subscriptions { get; set; }
}
实体测试
public class test
{
public string IMEINumber { get; set; }
public int? SubscriptionType { get; set; }
public string SubscriptionTypeName { get; set; }
public int CarrierId { get; set; }
public string CarrierName { get; set; }
public int AccountId { get; set; }
public string PhoneNo { get; set; }
public bool setAsPrimary { get; set; }
public string SIMNo { get; set; }
public string Puk1 { get; set; }
public string Puk2 { get; set; }
public int Id { get; set; }
public decimal Maxbudget { get; set; }
public bool SendConsumption { get; set; }
}
实体 CommonPropertiesViewModel
public class CommonPropertiesViewModel
{
public int Id { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime? ModifiedOn { get; set; }
public string CreatedBy { get; set; }
public string ModifiedBy { get; set; }
public string CustomMessage { get; set; }
public int ClientId { get; set; }
}
javascript函数
function SaveNew() {
var del = { "ClientId" : 0,
"CreatedBy" : null,
"CreatedOn" : "/Date(-62135596800000)/",
"CustomMessage" : null,
"DepartmentId" : 0,
"DeviceStatus" : null,
"Id" : 4,
"ModifiedBy" : null,
"ModifiedOn" : null,
"Subscriptions" : [ { "AccountId" : 421,
"CarrierId" : 1,
"CarrierName" : "Airtel",
"IMEINumber" : "352698040297280",
"Id" : 8,
"Maxbudget" : 250.0,
"PhoneNo" : "9409635039",
"Puk1" : "2415367892",
"Puk2" : "9818067434",
"SIMNo" : "485769351624",
"SendConsumption" : true,
"SubscriptionType" : 1,
"SubscriptionTypeName" : "Voice",
"setAsPrimary" : true
},
{ "AccountId" : 421,
"CarrierId" : 1,
"CarrierName" : "Airtel",
"IMEINumber" : "352276053001012",
"Id" : 9,
"Maxbudget" : 750.0,
"PhoneNo" : "4875351547",
"Puk1" : "9742277228",
"Puk2" : "2789210574",
"SIMNo" : "365289701254",
"SendConsumption" : true,
"SubscriptionType" : 1,
"SubscriptionTypeName" : "Voice",
"setAsPrimary" : true
}
],
"TypeOfDevice" : 1
}
$.ajax({
type: "POST",
url: $("#urlprefix").val() + 'AssetManagement/SaveNew',
data: { "del": JSON.stringify(del) },
success: function (d) {
console.log('here');
return false;
},
error: function (msg) {
}
});
}
完成所有这些之后……我的 AJAX 调用
[HttpPost]
public ActionResult SaveNew(AssetMgmt del)
{
return View("SaveNew", del);
}
当我在调试模式下悬停在突出显示的区域时,我应该得到从客户端发送到服务器的值。
我的问题是,当我进行 AJAX 调用时,del 没有任何价值。服务器端没有收到任何值。SaveNew(AssetMgmt del)中的 IE我得到空对象或空白对象。我想要的是从客户端发送的del值。