[Required(ErrorMessage = "Enter Height")]
[Range(0,999, ErrorMessage = "Height is too long")]
[RegularExpression(@"^[0-9]+$", ErrorMessage = "Enter Only Numbers")]
public Nullable<int> Height { get; set; }
i am posting in rest client
{
FighterID: 11,
Height:45,
Weight: 200,
Reach: 33,
}
in place of 45 when i pass any string like
<pre lang="cs">{
FighterID: 11,
Height:"ghgh"
Weight: 200,
Reach: 33,
}
its not checcking validation and giving error
{
Message: "The request is invalid."
ModelState: {
tblFighters.Height: [2]
0: "Could not convert string to integer: d. Path 'Height', line 8, position 12."
1: "Enter Height"
-
}-