コントロールのインライン編集が必要なプロジェクトに取り組んでいます。ビューを使用してモデルのプロパティを編集し、jquery ajax を使用してコントローラーに送信したい。$.ajax() を使用して完全なモデルをコントローラーに送信するにはどうすればよいですか
私のモデルは次のとおりです。
public class LeadDetail
{
public int EntityID { get; set; }
public string EntityName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public int PhoneType { get; set; }
public string PhoneNumber { get; set; }
public string PhoneExt { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Address3 { get; set; }
public string City { get; set; }
public int State { get; set; }
public string ZipCode { get; set; }
public string Country { get; set; }
public decimal Amount { get; set; }
public string LeadAssignedToName { get; set; }
public int RelatedAccount { get; set; }
public string LeadStatusName { get; set; }
public string LeadRatingName { get; set; }
public string LeadSourceName { get; set; }
public string CampaignName { get; set; }
public int LeadType { get; set; }
public string Url { get; set; }
public string Comments { get; set; }
public int Subscribed { get; set; }
public string CreatedDate { get; set; }
public string CreatedBy { get; set; }
public string utm_source { get; set; }
public string utm_term { get; set; }
public string IPAddress { get; set; }
public string utm_medium { get; set; }
public string utm_campaign { get; set; }
public string utm_content { get; set; }
public int RelatedAccountId { get; set; }
public int LeadTypeID { get; set; }
public int CampaignID { get; set; }
public string BirthDate { get; set; }
public string SocialSecurity { get; set; }
public string emailsubscriber { get; set; }
public string active { get; set; }
public int department { get; set; }
public int Title { get; set; }
public int PrimaryEmail { get; set; }
public int PrimaryPhone { get; set; }
public int PrimaryAddress { get; set; }
public string LeadAssignedDate { get; set; }
public int LeadRatingID { get; set; }
public int LeadStatusID { get; set; }
public int AccountType { get; set; }
public int EntityTypeID { get; set; }
public int LeadAssignedTo { get; set; }
public int AccountStatusID { get; set; }
public int LeadSourceID { get; set; }
public string PrimaryContact { get; set; }
public string stateName { get; set; }
}
そして私はコントローラーにメソッドを持っています:
[HttpPost]
public void updateDetail(LeadDetail Lead)
{
LeadDetail leadvalue = Lead;
}
完全なモデルをコントローラーに送信する正しい方法が必要です
$.ajax({
url: '/Test/updateDetail',
type: 'POST',
data: {
Lead:'@Model'
},
この ajax 投稿の後、メソッド updateDetail で null を取得し、それを改善する方法