updating countries
This commit is contained in:
		| @@ -1,9 +0,0 @@ | ||||
| using Domains; | ||||
|  | ||||
| namespace Infrastructure.Database.GeneralExceptions; | ||||
|  | ||||
| /// Exception to throw when entity not found | ||||
| /// <param name="id">Identifier of entity</param> | ||||
| /// <typeparam name="T">Type of entity</typeparam> | ||||
| public class EntityNotFoundByIdException<T>(Guid id) : EntityNotFoundException<T>($"{typeof(T).Name} with id {id} not found.") | ||||
|     where T : class, IEntity; | ||||
| @@ -1,9 +0,0 @@ | ||||
| using ApplicationLayer.GeneralExceptions; | ||||
| using Domains; | ||||
|  | ||||
| namespace Infrastructure.Database.GeneralExceptions; | ||||
|  | ||||
| /// Exception to throw when entity not found | ||||
| /// <typeparam name="T">Not found entity type</typeparam> | ||||
| public class EntityNotFoundException<T>(string message) : ApiException(message) | ||||
|     where T : class, IEntity; | ||||
| @@ -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); | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user