updating countries

This commit is contained in:
2024-08-20 21:34:56 +03:00
parent 19e792e670
commit a0d002b465
14 changed files with 119 additions and 10 deletions

View File

@@ -12,4 +12,7 @@ public sealed class CitiesRepository(IGenericReader reader, IGenericWriter write
{
return base.LoadDomain().Include(c => c.Country);
}
Task<City?> ICitiesRepository.GetByNameAsync(Guid countryId, string cityName, CancellationToken cancellationToken)
=> LoadDomain().SingleOrDefaultAsync(c => c.Country.Id == countryId && c.Name == cityName, cancellationToken);
}

View File

@@ -13,9 +13,15 @@ public sealed class CountriesRepository(IGenericReader reader, IGenericWriter wr
return base.LoadDomain().Include(c => c.Cities);
}
async Task<Country?> ICountriesRepository.FindByName(string countryName, CancellationToken cancellationToken)
async Task<Country?> ICountriesRepository.FindByNameAsync(string countryName, CancellationToken cancellationToken)
{
var result = await LoadDomain().SingleOrDefaultAsync(c => c.Name == countryName, cancellationToken);
return result;
}
async Task<Country?> ICountriesRepository.FindByIdAsync(Guid id, CancellationToken cancellationToken)
{
var result = await LoadDomain().SingleOrDefaultAsync(c => c.Id == id, cancellationToken);
return result;
}
}