I am trying to use model validation in ASP.NET WEBAPI Core. Below mentioned is the code from my model.
[Range(typeof(decimal), "1.0", "90.1")]
public decimal price{ get; set; }
My understanding is, if I pass any value which is not in between 1.0 - 90.1, the ModelState.Valid
should be false.
Here is the url I tried to call the method,
http://localhost:57270/api/testprice?price=132.7492634
Since the value which I have passed greater than 90, I was expecting ModelState.Valid
as false. But always the ModelState.Valid
is coming as true.
Am I missing anything? Please help?