コード例 #1
0
 protected override  ValidationResult IsValid(object value,  ValidationContext validationContext)
 {
     employeeDataAccessObject = Container.Resolve<IEmployeeDAO>();
     if (!employeeDataAccessObject.Exists((validationContext.ObjectInstance as EmployeeViewModel).AsEmployeeModel()))
     {
         return ValidationResult.Success;
     }
     return new ValidationResult("Oops, something went wrong, seems this employee has already been added");
 }
コード例 #2
0
 protected override ValidationResult IsValid(object value, ValidationContext validationContext)
 {
     employeeDataAccessObject = Container.Resolve <IEmployeeDAO>();
     if (!employeeDataAccessObject.Exists((validationContext.ObjectInstance as EmployeeViewModel).AsEmployeeModel()))
     {
         return(ValidationResult.Success);
     }
     return(new ValidationResult("Oops, something went wrong, seems this employee has already been added"));
 }