Beispiel #1
0
 private void AddValidations()
 {
     Email = new ValidatableObject <string>(true)
     {
         Value = ""
     };
     Email.RegisterValidationRule(new IsNotNullOrEmptyRule()
     {
         ValidationMessage = "Email is required."
     });
     Email.RegisterValidationRule(new EmailRule()
     {
         ValidationMessage = "Provide The valid email address."
     });
     Password = new ValidatableObject <string>(true)
     {
         Value = ""
     };
     Password.RegisterValidationRule(new IsNotNullOrEmptyRule()
     {
         ValidationMessage = "Password is required."
     });
     Password.RegisterValidationRule(new PasswordRule(false, true, true, true, 8)
     {
         ValidationMessage = "Passwords must be 8 more characters in length. Must contain at least 1 upper, 1 numeric and 1 special character."
     });
     ConfirmPassword = new ValidatableObject <string>(true)
     {
         Value = ""
     };
     ConfirmPassword.RegisterValidationRule(new IsNotNullOrEmptyRule()
     {
         ValidationMessage = "Confirm password is required."
     });
     ConfirmPassword.RegisterValidationRule(new ConfirmPasswordRule(() => Password.Value)
     {
         ValidationMessage = "Password and confirm password are not same."
     });
 }