public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (CustomRepository.CheckCustomerExistsOrNot(Gstnumber, PanNumber, PhoneNumber, CustomerId)) { var fieldName = new[] { "Name" }; yield return(new ValidationResult("Customer is Already Exists.", fieldName)); } }