应用程序成功达到这个功能:
save: function ()
{
debugger;
$.ajax({
url: "http://localhost/x/api/awards/directors",
type: "POST",
data: directorData
}).done(function () {
alert('done!');
});
},
directorData 包含以下内容:
{
"awardTitleId": "1",
"personId": "1657",
"nameId": "1651",
"isOnBallot": "True",
"concatenationString": "test1"
}
我不确定为什么会收到此错误。这是一个屏幕截图:
这是控制器的样子:
public void PostDirector(Director director)
{
myConnection.Open();
var query = "INSERT INTO ...";
var cmd = new SqlCommand(query, myConnection);
cmd.ExecuteNonQuery();
myConnection.Close();
}