trying to implement this demo in our .net core project targeting core 2.1. taking one step at a time -
I have modeled my view models based on your examples and my controller after your datasource controller - i don't use services
At this point I am able to bind and return data from our database. The spreadsheet is fine at this point and all I am trying to do now is get the data into the
Controller submit method.
i have set up my ajax call as you have in the 2018 R2 release examples - for saving changes
function onSubmit(e) {
$.ajax({
type: "POST",
url: '@Url.Action("Data_Source_Products_Submit", "Spreadsheet")',
data: e.data,
dataType: "json",
success: function (result) {
e.success(result.Updated, "update");
e.success(result.Created, "create");
e.success(result.Destroyed, "destroy");
},
error: function (xhr, httpStatusMessage, customErrorMessage) {
alert(xhr.responseText);
}
});
}
When I hit Save and debug , I can see that the data is there in the updated array (the other 2 are empty)
however when i got to the controller - the ModelState was inValid
if I add the contentType: "application/json", then ModelState will be valid but the input model updated parameter is null
just the fact that i need to add the content type to the ajax call tells me there is something fundamentally different between your core project and mine
your project has so many pieces I cannot easily if i am missing something simple or something big
Do you have any idea why i am needing to add the content type to get the ModelState valid?
And why the Updated array is null in the controller when I can see the data in the array on the client side?
thanks
Jim