I have this function with array and I am not able to pass to the controller values, I listing, it appears correctly, I use angular.
$scope.addItem = function (user) {
$scope.items.push({
de: $scope.total,
ate: user.ate,
tipo: user.tipo,
valor: user.valor,
});
$scope.total = ''
$scope.total = user.ate;
user.ate = '';
user.tipo = '';
user.valor = '';
};
$scope.gravaItem = function () {
$.ajax({
type: 'GET',
url: '/TaxaPreco/SalvarItens',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify($scope.items),
success: function (result) {
console.log('Data received: ');
console.log(result);
}
})
};
And here are the result when I give console.log($scope.items)
;
Array(1)
0
:
{de: "00:01", ate: "00:29", tipo: "0", valor: "5", $$hashKey: "object:3"}
How can I pass these values to the controller ? And here's how I'm trying to get into the controller , but anyway, none worked as it should:
public async Task<ActionResult> SalvarItens(List<TarifasPrecosItens> nome )
{
var item = new TarifasPrecosItens()
{
De = nome[0].De,
//De = itens.De,
//Ate = itens.Ate,
//Fracao = itens.,
//RepetirACada = 0,
//TipoValor = tipovalor,
//Valor = valor,
//TarifasPrecosId = 25,
};