예제 #1
0
    public void Validate()
    {
        var errors = DataAnnotationsValidationRunner.GetErrors(this);

        if (errors.Any())
        {
            throw new RulesException(errors);
        }
    }
예제 #2
0
        private void Validate(ExampleModel example)
        {
            var errors = DataAnnotationsValidationRunner.GetErrors(example);

            if (errors.Any())
            {
                throw new AtomiaServerSideValidationException(errors);
            }
        }
예제 #3
0
    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"));
    }
예제 #4
0
 /// <summary>
 /// Validates this instance.
 /// </summary>
 /// <returns></returns>
 public ValidationErrorCollection Validate()
 {
     _errors = DataAnnotationsValidationRunner.GetErrors(this);
     OnValidating(_errors);
     return(_errors);
 }