In my application I created an API in C #, which is consumed by my web application in Angular. I need to pass 1 object and 1 vector as parameters to the API, but the content comes empty in the API, how to solve?
Here are my codes:
Part of JavaScript:
$scope.Exportar = function () {
var listProdutos = {
ListaCompraVenda : {listacompravenda: $scope.modelcompraevenda.listProdutos},
ListaMeses : {meses:[$scope.dataBase.data1,
$scope.dataBase.data2,
$scope.dataBase.data3,
$scope.dataBase.data4,
$scope.dataBase.data5,
$scope.dataBase.data6,
$scope.dataBase.data7,
$scope.dataBase.data8,
$scope.dataBase.data9,
$scope.dataBase.data10,
$scope.dataBase.data11,
$scope.dataBase.data12]}
};
$http.post($rootScope.raiz_ws + "/local/funcao", listProdutos )
.then(function (response) {
});
};
Controller in C #
[HttpPost]
[Route("funcao")]
public HttpResponseMessage Gerar(Classe listProdutos)
{..}
C # Class:
public class Classe
{
public List<CompraeVenda> ListaCompraVenda { get; set; }
public List<string> ListaMeses { get; set; }
}