Esempio n. 1
0
    public async Task <IList <Provider> > GetAllProviders()
    {
        var providers =
            (await _providerRepository.GetAll())
            .ToProviderList();

        var locationEntities = await _locationRepository.GetAll();

        var locationGroups = locationEntities
                             .GroupBy(x => x.PartitionKey)
                             .Select(group => new
        {
            UkPrn = group.Key,
            Items = group.ToLocationList()
        })
                             .ToDictionary(g => g.UkPrn.ToString());

        foreach (var provider in providers)
        {
            if (locationGroups.TryGetValue(provider.UkPrn.ToString(), out var location))
            {
                provider.Locations = location.Items;
            }
        }

        if (_logger.IsEnabled(LogLevel.Debug))
        {
            _logger.LogDebug("TableStorageService::GetAllProviders found {providersCount} providers with {locationEntitiesCount} locations.",
                             providers.Count, locationEntities.Count);
        }

        return(providers);
    }
Esempio n. 2
0
        public async Task <IList <Qualification> > GetAllQualifications()
        {
            var qualifications =
                (await _qualificationRepository.GetAll())
                .ToQualificationList();

            _logger.LogInformation($"RetrieveQualifications found {qualifications.Count} records.");

            return(qualifications);
        }
Esempio n. 3
0
    public async Task <IList <Qualification> > GetAllQualifications()
    {
        var qualifications =
            (await _qualificationRepository.GetAll())
            .ToQualificationList();

        if (_logger.IsEnabled(LogLevel.Debug))
        {
            _logger.LogDebug("TableStorageService::GetAllQualifications found {qualificationsCount} records.",
                             qualifications.Count);
        }

        return(qualifications);
    }
Esempio n. 4
0
        public async Task <IList <Provider> > GetAllProviders()
        {
            var providerEntities = await _providerRepository.GetAll();

            var providers = providerEntities.ToProviderList();

            var locationCount = 0;

            foreach (var provider in providers)
            {
                var locationEntities = await _locationRepository.GetByPartitionKey(provider.UkPrn.ToString());

                provider.Locations = locationEntities.ToLocationList();
                locationCount     += locationEntities.Count;
            }

            _logger.LogInformation($"TableStorageService::RetrieveProviders found {providers.Count} providers with {locationCount} locations.");
            return(providers);
        }