public void Validate() { var errors = DataAnnotationsValidationRunner.GetErrors(this); if (errors.Any()) { throw new RulesException(errors); } }
private void Validate(ExampleModel example) { var errors = DataAnnotationsValidationRunner.GetErrors(example); if (errors.Any()) { throw new AtomiaServerSideValidationException(errors); } }
public ActionResult Register(RegisterPageModel model) { //run server validation var errors = DataAnnotationsValidationRunner.GetErrors(model); if (errors.Any()) { return(View(model)); } var attendee = Map.RegisterToCurrentAttendee(model); CurrentAttendee.Add(attendee); return(Redirect("~/attendee/list")); }
/// <summary> /// Validates this instance. /// </summary> /// <returns></returns> public ValidationErrorCollection Validate() { _errors = DataAnnotationsValidationRunner.GetErrors(this); OnValidating(_errors); return(_errors); }