[HttpPost("method")]
public string Method(int number)
{
    return number.ToString();
}
Why number is always 0?
Its possible to use json post with primitive types like this?
My post: { "number" : 3 }
If you post data like { "number" : 3 }, your action method should be
public class Data
{
   public int Number {get; set;}
}
[HttpPost("method")]
public string Method([FromBody] Data data)
{
    return data.Number.ToString();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With