当ajax请求控制器更新实体时,我可以在ajax中看到列表值。但是当它碰到控制器时,同一对象将变为空。
$.ajax({
traditional: true,
async: true,
type: 'PUT',
headers: { 'X-CSRF-TOKEN': $("input[name='__RequestVerificationToken']").val() },
url: "/AccessLevel/ModifyAccessLevelFeatureMapping",
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify(accessLevelFeatureList),
processData: false,
cache: false,
success: function (data)
{
}
控制器>>
[HttpPut]
[ExcludeFromCodeCoverage]
public async Task<JsonResult> ModifyAccessLevelFeatureMapping([FromBody]IEnumerable<FeatureMasterModel> featureModel) --null value!!
{
try
{
var accessLevelFeatures = await accessLevelService.UpdateAccessLevelFeature(featureModel);
return Json(new { accessLevelFeatures });
}
}