Exemple #1
0
    public async Task <int> SaveProviders(IList <Provider> providers)
    {
        if (providers == null || !providers.Any())
        {
            return(0);
        }

        var providerEntities = providers.ToProviderEntityList();

        var saved = await _providerRepository.Save(providerEntities);

        var savedLocations   = 0;
        var deletedLocations = 0;

        foreach (var provider in providers)
        {
            deletedLocations += await _locationRepository.DeleteByPartitionKey(provider.UkPrn.ToString());

            savedLocations += await _locationRepository
                              .Save(provider.Locations.ToLocationEntityList(provider.UkPrn.ToString()));
        }

        _logger.LogInformation("TableStorageService::SaveProviders saved " +
                               $"{saved} providers, " +
                               $"and saved {savedLocations} " +
                               $"and deleted {deletedLocations} locations.");
        return(saved);
    }
Exemple #2
0
    public async Task <int> SaveQualifications(IList <Qualification> qualifications)
    {
        if (qualifications == null || !qualifications.Any())
        {
            return(0);
        }

        var qualificationEntities = qualifications.ToQualificationEntityList();

        var saved = await _qualificationRepository.Save(qualificationEntities);

        _logger.LogInformation("TableStorageService::SaveQualifications saved {saved} records.", saved);
        return(saved);
    }