I have some json object in the client (browser in this case) as follows
objeto = {
idSala: idSala,
listaEtapas: listaEtapas,
listaMacros: listaMacros,
listaTI: listaTI,
listaTU: listaTU,
listaUnidades: listaUnidades,
listaTorres: listaTorres,
valor: valor,
regla: regla,
finicio: finicio,
ffin: ffin,
activo: activo
};
$.post("/api/reglas", objeto).done(function() {
alert("ok");
})
As you see I'm sending it thru jquery post method to a IISexpress server on my own developing machine.
In C# I've created the corresponding model:
public class reglaInsercion
{
int idSala { get; set; }
int[] listaMacros { get; set; }
int[] listaEtapas { get; set; }
int[] listaTI { get; set; }
int[] listaTU { get; set; }
int[] listaUnidades { get; set; }
string [] listaTorres { get; set; }
double valor { get; set; }
string regla { get; set; }
DateTime finicio { get; set; }
DateTime ffin { get; set; }
bool activo { get; set; }
}
And I also have set the respective controller action
[Route("api/reglas")]
[HttpPost]
public HttpResponseMessage postRegla(reglaInsercion laRegla)
{
return Request.CreateResponse(HttpStatusCode.OK);
}
But when I debug my code the laRegla object has alll its members to null or zero depending of the data type. What am I missing? I've read the docs and I can't find what I'm doing wrong.
Uncaught ReferenceError: idSala is not defined.