ajax 缺少 ),jquery AJAX缺少服务器响应中的对象

我对我的控制器进行了基本的ajax调用:

$.ajax({

url: 'Final/EditCustomer/' + '@Model.CustomerId',

success: function (data) {

console.log(data);

}

});

到目前为止,这工作正常,在我的客户对象中调用控制器操作,包括Tenant对象和CustomerType对象:

public IActionResult EditCustomer(int ID)

{

var customer = new TCustomer();

customer = _context.TCustomer

.Where(c => c.CustomerId == 1)

.Include(x => x.Tenant)

.Include(y => y.CustomerType)

.FirstOrDefault();

return new ObjectResult(customer);

}

现在这里很奇怪,当我在我的ajax调用中检索对象时,我可以在控制台中看到Customer对象具有包含CustomerType对象的值,但是我没有得到来自服务器的租户对象,即使它告诉我它是从控制器发送的:

修改

TCustomer模型:

namespace DAL.Entities

{

[Table("T_Customer")]

public partial class TCustomer

{

public TCustomer()

{

TCustomerDocument = new HashSet();

TLinkMgmtNetToCustomer = new HashSet();

TLinkPersonToCustomer = new HashSet();

TLinkSrvAppAcntToCustomer = new HashSet ();

TPersonalAccount = new HashSet();

TUserFavoritCustomer = new HashSet();

}

[Column("Customer_ID")]

[Key]

public int CustomerId { get; set; }

//[Required]

//[MaxLength(250)]

//public string Customer { get; set; }

[MaxLength(250)]

public string Notes { get; set; }

public string Message { get; set; }

[Column("Old_SiteID")]

public int? OldSiteId { get; set; }

[MaxLength(50)]

public string ImportQueryName { get; set; }

[Column(TypeName = "datetime")]

public DateTime? ImportDate { get; set; }

[MaxLength(50)]

public string FirmIndex { get; set; }

[MaxLength(50)]

public string BskNumberCustomer { get; set; }

public bool MaintenanceReasonRequired { get; set; }

[Column("Tenant_ID")]

public int TenantId { get; set; }

[Column("CustomerType_ID")]

public int CustomerTypeId { get; set; }

[MaxLength(50)]

public string UpdateUser { get; set; }

[Column(TypeName = "datetime")]

public DateTime? UpdateDate { get; set; }

[MaxLength(50)]

public string AddUser { get; set; }

[Column(TypeName = "datetime")]

public DateTime? AddDate { get; set; }

public bool? Recording { get; set; }

[Column("CH_Location")]

public bool? ChLocation { get; set; }

public bool? ProactiveSurveillance { get; set; }

[InverseProperty("Customer")]

public virtual ICollection TCustomerDocument { get; set; }

[InverseProperty("Customer")]

public virtual ICollection TLinkMgmtNetToCustomer { get; set; }

[InverseProperty("Customer")]

public virtual ICollection TLinkPersonToCustomer { get; set; }

[InverseProperty("Customer")]

public virtual ICollection TLinkSrvAppAcntToCustomer { get; set; }

[InverseProperty("Customer")]

public virtual ICollection TPersonalAccount { get; set; }

[InverseProperty("Customer")]

public virtual ICollection TUserFavoritCustomer { get; set; }

[ForeignKey("CustomerTypeId")]

[InverseProperty("TCustomer")]

public virtual TCustomerType CustomerType { get; set; }

[ForeignKey("TenantId")]

[InverseProperty("TCustomer")]

public virtual TTenant Tenant { get; set; }

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值