7
I have an Asp.Net MVC project and I’m trying to repurpose an Action that returns Json within the server, but I’m unable to work with Json returns in C#.
I’m doing research, but I haven’t found anything to help me so far.
Excerpt from the code:
public ActionResult MinhaAction(int param)
{
var minhaListaDeObjetos = new List<int>(){ 1, 2, 3};
return Json(new
{
success = true,
data = minhaListaDeObjetos
}, JsonRequestBehavior.AllowGet);
}
In another Action I have:
var resultado = MinhaAction(param);
How to access data within resultado
?
I’ve been trying so:
resultado.data.minhaListaDeObjeto.First();
The result should be 1
, but that line doesn’t work.