I'm passing an angular array by JSON this way:
$scope.gravaItem = function () {
$.ajax({
type: 'GET',
url: '/TaxaPreco/SalvarItens',
dataType: 'json',
contentType: "application/json; charset=utf-8",
data: { DeJson: JSON.stringify($scope.items) },
success: function (result) {
console.log('Data received: ');
console.log(result);
}
})
};
And no controller
this way:
public async Task<ActionResult> SalvarItens(string DeJson)
{
var arr = DeJson.Split(',');
var item = new TarifasPrecosItens()
{
De = arr[0],
Ate = "01:01",
Fracao = 0,
RepeteACada = 0,
TipoValor = 1,
Valor =5,
TararifaPrecosId = 25,
};
_context.TarifasPrecosItens.Add(item);
_context.SaveChanges();
return new JsonResult(DeJson);
}
In it it gets the following value:
[{"de": "00:01"
How can I resolve the value correctly? I need to get all the values, in this case I should just get:
00:01