I'm trying to pass a JSON Object to a method in my controller and I'm not getting it, the problem is that the email field always returns null.
How to do this?
I'm trying like this.
JSON Object
{"UsuarioJsonModel": {"email":"[email protected]", "senha":"xxxxxx"}}
Model
public class UsuarioJsonModel
{
public long id { get; set; }
public String nome { get;set;}
public String email {get;set;}
public String senha {get;set;}
public int status { get; set; } //1 ativo, 2 inativo, 0 aguardando
public int tipo { get; set; } //1 painel, 2 aplicativos
public String imagem { get; set; }
public int loginBy { get; set; } //0 app, 1 facebook
public UsuarioJsonModel() { }
}
Method that receives JSON Object
[WebMethod]
[HttpPost]
public JsonResult doLoginApp(UsuarioJsonModel model)
{
jsonResposta.Add("status", "1");
jsonResposta.Add("email", model.email);
return Json(jsonResposta);
}