web-api POST body object always null

前端 未结 26 2928
余生分开走
余生分开走 2020-11-27 15:03

I\'m still learning web API, so pardon me if my question sounds stupid.

I have this in my StudentController:

public HttpResponseMessage          


        
26条回答
  •  清酒与你
    2020-11-27 15:36

    I was looking for a solution to my problem for some minutes now, so I'll share my solution.

    When you have a custom constructor within your model, your model also needs to have an empty/default constructor. Otherwise the model can't be created, obviously. Be careful while refactoring.

提交回复
热议问题