Error sending json in POST to web API service

后端 未结 6 2080
醉梦人生
醉梦人生 2020-12-13 11:53

I\'m creating a web service using Web API. I implemented a simple class

public class ActivityResult
{
    public String code;
    public int indexValue;
             


        
6条回答
  •  天涯浪人
    2020-12-13 12:15

    I had all my settings covered in the accepted answer. The problem I had was that I was trying to update the Entity Framework entity type "Task" like:

    public IHttpActionResult Post(Task task)
    

    What worked for me was to create my own entity "DTOTask" like:

    public IHttpActionResult Post(DTOTask task)
    

提交回复
热议问题