I'm trying pass a JSON object to a method in asp.net mvc 4 but it always return null.
How could I do this ?
trying
Asp.Net Method
[WebMethod]
public JsonResult doLoginApp(string model){
jsonResposta.Add("status", "1");
jsonResposta.Add("email", model);
return Json(jsonResposta);
}
JSON Object
{"User": {"email":"[email protected]", "password":"xxxxx"}};
Return
{
"status": "1",
"email": null
}
URL
http://localhost:14807/User/doLoginApp
Edit Post
Model
public class UserJsonModel{
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 UserJsonModel() { }
}
Asp.NET method
[WebMethod]
[HttpPost]
public JsonResult doLoginApp(UserJsonModel model){
jsonResposta.Add("status", "1");
jsonResposta.Add("email", model.email);
return Json(jsonResposta);
}