Remember once mvc entity object is to get the issue null

At work, there are times to send ajax request to increase the background data, the background to get the value is always empty

public JsonResult SaveScore(BASE_SCORE score)
{
ScoreBLL scoreBLL = new ScoreBLL();
return Json(scoreBLL.AddScore(baseScore));
}

 

js

var score = {
SCORETYPEID: typeId,
CLASSID: classId,
PERSONID: personId,
SCORE: itemScore,
REMARK: remark,
SCOREDETAILS: scoreDetails,
};
common.AjaxPost("/BJAppScoring/SaveScore", score, function (data) {
var data = JSON.parse(data);
if (data.status == true) {
alert(data.msg);
window.location.href = "/BJAppScoring/BJAppScoringIndex";
} else {
alert("msg:" + data.msg)
}
}

 

 

Find a few hours, use a process of elimination to exclude attributes to finalize the issue appeared on the score parameters, modify the type of score, or not found, changed the name, can be found, this time to the list, controller received parameter name and attributes transmitted in a score of the same name, so that the error caused by

Guess you like

Origin www.cnblogs.com/sharestone/p/11689686.html