Example #1
0
        public static void ProviderVenueRef <T>(
            this IRuleBuilderInitial <T, string> field,
            Guid providerId,
            Guid?venueId,
            ISqlQueryDispatcher sqlQueryDispatcher)
        {
            field
            .ProviderVenueRef(
                getOtherVenueProviderVenueRefs: async _ =>
            {
                var venues = await sqlQueryDispatcher.ExecuteQuery(new GetVenuesByProvider()
                {
                    ProviderId = providerId
                });

                return(venues
                       .Where(v => v.VenueId != venueId && !string.IsNullOrEmpty(v.ProviderVenueRef))
                       .Select(v => v.ProviderVenueRef)
                       .ToArray());
            });
        }