baaaaaaahhhhhhhhh Soooooorrrrry
The Issue were completely on the wrong side.... nothing with my script or my controller.
the Model was the problem
as I mentioned in the comment I tried with
$('#btnClick').click(function (e) {
canvasFields = [{
id: 1,
recStartx: 2,
recStarty: 3,
recWidth: 4,
recHeight: 5
},
{
id: 2,
recStartx: 2,
recStarty: 3,
recWidth: 4,
recHeight: 5
}];
$.ajax({
url: "@Url.Action("GetCanvasFields")",
type: 'post',
contentType: 'application/json',
data: JSON.stringify(canvasFields),
success: function () {
alert("yes");
},
error: function (errMsg) {
alert(errMsg);
}
})
});
and When I checked the actual json string by
myJsonString = JSON.stringify(canvasFields);
and then compare it using the same step with my dynamic filled canvasFields
I figured out that the values in my json string are from type float and my model was set to accept int.
so by changing my model to double everything worked:
public class CanvasField
{
public double Id { get; set; }
public double RecStartx { get; set; }
public double RecStarty { get; set; }
public double RecWidth { get; set; }
public double RecHeight { get; set; }
}