Ejemplo n.º 1
0
 public ActionResult ChildVacationList(ChildVacationListModel model)
 {
     RequestBl.SetChildVacationListModel(model, !ValidateModel(model));
      //ModelState.Clear();
      return View(model);
 }
Ejemplo n.º 2
0
 protected bool ValidateModel(ChildVacationListModel model)
 {
     if (model.BeginDate.HasValue && model.EndDate.HasValue &&
          model.BeginDate.Value > model.EndDate.Value)
          ModelState.AddModelError("BeginDate", "Дата в поле <Период с> не может быть больше даты в поле <по>.");
      if (model.Number != null)
      {
          try { Convert.ToInt32(model.Number); }
          catch{ ModelState.AddModelError("Number", "Номер заявки числовое поле");}
      }
      return ModelState.IsValid;
 }