Created
October 16, 2010 20:34
-
-
Save kouphax/630234 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PasswordsMustMatchAttribute : ValidationAttribute | |
{ | |
protected override ValidationResult IsValid( | |
object value, ValidationContext validationContext) | |
{ | |
var model = validationContext.ObjectInstance as Person; | |
if (model.Password == model.PasswordConfirm) | |
{ | |
return ValidationResult.Success; | |
} | |
return new ValidationResult( | |
"Password and Password Confirmation must match", | |
new string[] { "Password", "PasswordConfirm" }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment