From a30691ea1071b48e59a5d0dbfb4fcf4330f66ebe Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 19 Aug 2024 12:36:01 +0100 Subject: [PATCH] Fix for alternative location --- .../Features/Participants/Commands/SetEnrolmentLocation.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Application/Features/Participants/Commands/SetEnrolmentLocation.cs b/src/Application/Features/Participants/Commands/SetEnrolmentLocation.cs index abf05422..a2623703 100644 --- a/src/Application/Features/Participants/Commands/SetEnrolmentLocation.cs +++ b/src/Application/Features/Participants/Commands/SetEnrolmentLocation.cs @@ -77,7 +77,9 @@ public Validator() When(x => x.EnrolFromAlternativeLocation, () => { RuleFor(x => x.AlternativeLocation) .NotNull() - .WithMessage("You must provide an alternative location") + .WithMessage("You must provide an alternative location"); + + RuleFor(x => x.AlternativeLocation) .Must((x, alternativeLocation) => x.CurrentLocation.Id != alternativeLocation!.Id) .When(x => x.AlternativeLocation is not null) .WithMessage("You must provide a different alternative location to the current location");