I have a view model like this:
public class IndexVM
{
[Required]
// Must be either a 0, 5, 10, 25 or 50
public int RadiusInMile { get; set; }
}
How can I tell MVC that the int
must be either a 0
, 5
, 10
, 25
or a 50
? For anything other than those values ModelState.IsValid
ought to return false
.
I know about the Range[]
validation attribute, but doesn't really work for me because I don't have a smooth range.