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