0
I’m sending an array of angular js for the controller of C#, and I’m treating him with stringfy for json.
Only in my way POST
he gets nothing, just returns null
Code C#
public void Post(string values)
{
var r = values;
}
Javascript code
$scope.SubmitData = function (DataToSubmit) {
var string = JSON.stringify(DataToSubmit);
$http({
method: 'POST',
data: {
values: string,
},
url: 'api/aulamethod',
});
}
Date which is inserted in Inserts
data appearing on var string
after the stringfy
values:"[{"CompanyName":"column a","SupplierCode":"column b","DocumentNumber":"column c","Reference":"column d","InternalCurrencyValue":"column e","BlockadeUnblocking1":"column f","Justification":"column g","Request":"column h","$$hashKey":"object:23"}]"
Try it this way:
data: { string }
– Marconi
not from :/ already tried
– mateus andrade
I believe he considers
aulamethod
as the method name in c#– Thiago Magalhães
In your Post method change your signature to (List<string> values).
– Netinho Santos
yes I changed, I sent wrong pq forgot to change, already put aulamethod... I will try netinho m/
– mateus andrade
didn’t work tbm
– mateus andrade
What is the MVC version of your Webapi?
– Leandro Angelo