Failed to send information to asp.net MVC controller using post translation

I am trying to send JSON to an asp.net MVC controller. While I can call the endpoint using postman, the data that was posted is null.

This is what my controller looks like:

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 just return the input, and if you go to the output in Postman, the name is null and the age is 0.

Did I miss something?

enter image description here

+3


source to share





All Articles