I try to make simple POST request to 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, i 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 i try to test this request (by Postman) i have 200 code. But, when i make breakpoint into this method- it does not work. So, as i assume, this method do not call by framework.
Can you help me: why this method do not call?And how to fix that?