I have an Asp.Net MVC project and I am trying to reuse an Action that returns Json inside the server, but I am not able to work with Json returns in C #.
I'm doing research, but I have not found anything that will help me so far.
Code snippet:
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 like this:
resultado.data.minhaListaDeObjeto.First();
The result should be 1
, but this line does not work.