I am using simple form fluent validations. How to enter into this rule only if it's Notes Textbox is empty and should return validation if that linq query returns a record.
If textbox is not empty it should not enter into this rule.
Here's what I have tried
RuleFor(i => i.Notes)
.NotEmpty()
.When((i) =>
{
bool result = false;
result = _DAL.GetExists<EmployeeScheduleTypes>
(q => q.Type == i.Type);
return result;
})
.WithMessage("Notes is required");