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"); }
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")); }