protected bool ValidateModel(VacationListModel model) { if(model.BeginDate.HasValue && model.EndDate.HasValue && model.BeginDate.Value > model.EndDate.Value) ModelState.AddModelError("BeginDate", "Дата в поле <Период с> не может быть больше даты в поле <по>."); return ModelState.IsValid; }
public ActionResult VacationList(VacationListModel model) { RequestBl.SetVacationListModel(model, !ValidateModel(model)); ModelState.Clear(); return View(model); }