Exemple #1
0
        public static IRuleBuilderOptions <T, Guid?> OrganisationMustBeInScope <T>(this IRuleBuilder <T, Guid?> ruleBuilder, DataContext dataContext, ScopeOptions scope)
        {
            return(ruleBuilder.Must((root, organisationId, context) =>
            {
                if (!organisationId.HasValue)
                {
                    return false;
                }

                return ScopeQuery.IsOrganisationInScope(scope, organisationId.Value);
            })
                   .WithMessage(DOESNT_EXIST_MESSAGE)
                   .WithName("Organisation"));
        }