Unable to post information to asp.net MVC controller using postman

1.4k Views Asked by At

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?

enter image description here

0

There are 0 best solutions below