first commit
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Landmark.OLA.Models.Individuals.Validators
|
||||
{
|
||||
class ApplicantValidator : AbstractValidator<IApplicant>
|
||||
{
|
||||
public ApplicantValidator()
|
||||
{
|
||||
RuleForEach(x => x.Employers).SetValidator(new EmployerValidator());
|
||||
|
||||
When(x => x.DetailedNonApplicantSpouse is not null, () =>
|
||||
{
|
||||
RuleForEach(x => x.DetailedNonApplicantSpouse.Employers).SetValidator(new EmployerValidator());
|
||||
});
|
||||
|
||||
When(x => x.NonApplicantSpouse is not null, () =>
|
||||
{
|
||||
//An individual can only have a single spouse entry
|
||||
RuleFor(x => x.DetailedNonApplicantSpouse).Null();
|
||||
});
|
||||
|
||||
RuleFor(x => x.SecondaryPhoneType).NotNull().When(x => x.SecondaryPhone?.Length > 0)
|
||||
.WithMessage("SecondaryPhoneType must be set when a SecondaryPhone value is present.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user