I have a ViewModel which contains a form:
@using(Html.BeginForm())
{
@Html.EditorFor(x=>x.Price)
<input type="submit" value="Submit" />
}
In my Controller Action which loads this View, I have set the Price and pass it to the View. For example I've set it to 3:
public ActionResult MyAction()
{
MyModel model = new MyModel();
model.Price = 3;
return View(model);
}
What I want to do, is when this form is submitted I want to check to see if the value submitted by the user is less than the original value, in this case 3. Is that possible with Model Validation? So if I input 2, then the ModelState would be invalid but if I input 4, it would be valid.