c# - How to make POST with parameters> -


i try make simple post request webapi:

http://localhost::60310/locations/15 

full request are:

https://imgur.com/a/fgguj 

my controller:

[produces("application/json")] [route("/locations")] public class locationscontroller : controller {  [httppost("{id}")]     public async task<iactionresult> putlocation()      {        var distance= request.form.firstordefault(p => p.key == "distance").value;         var city = request.form.firstordefault(p => p.key == "city").value;         var place= request.form.firstordefault(p => p.key == "place").value;         var county= request.form.firstordefault(p => p.key == "country").value;         var id = request.form.firstordefault(p => p.key == "id").value;        //some code      }  } 

so, have data class:

  public class location {     [jsonproperty("distance")]     public int distance { get; set; }     [jsonproperty("city")]     public string city { get; set; }     [jsonproperty("place")]     public string place { get; set; }     [jsonproperty("id")]     public int id { get; set; }     [jsonproperty("country")]     public string country { get; set; } } 

when try test request (by postman) have 200 code. but, when make breakpoint method- not work. so, assume, method not call framework.

can me: why method not call?and how fix that?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -