I am trying to send JSON to asp.net MVC controller. While I am able to call the endpoint using postman, the data which is posted is going an null.
This is how my controller looks:
public class DataController : Controller
{
//
// GET: /Data/
[HttpPost]
public ActionResult Index(Employee e)
{
return Json(e, JsonRequestBehavior.AllowGet);
}
}
public class Employee
{
public string Name { get; set; }
public int Age { get; set; }
}
I am just returning the input & if you se the output in Postman, name is null and age is 0.
Am I missing anything?