Admin controller, Locations controller, requests to add available countries, request to get available countries
This commit is contained in:
		| @@ -8,8 +8,10 @@ public class CountryConfiguration : IEntityTypeConfiguration<Country> | ||||
| { | ||||
|     public void Configure(EntityTypeBuilder<Country> entity) | ||||
|     { | ||||
|         entity.Property(p => p.Name) | ||||
|         entity.Property(c => c.Name) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(70); | ||||
|  | ||||
|         entity.HasIndex(c => c.Name).IsUnique(); | ||||
|     } | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Cities; | ||||
|  | ||||
| public sealed class CitiesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||
|     : GenericRepository<City>(reader, writer, unitOfWork), ICitiesRepository | ||||
| public sealed class CitiesRepository(IGenericReader reader, IGenericWriter writer) | ||||
|     : GenericRepository<City>(reader, writer), ICitiesRepository | ||||
| { | ||||
|     protected override IQueryable<City> LoadDomain() | ||||
|     { | ||||
|   | ||||
| @@ -5,11 +5,17 @@ using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Countries; | ||||
|  | ||||
| public sealed class CountriesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||
|     : GenericRepository<Country>(reader, writer, unitOfWork), ICountriesRepository | ||||
| public sealed class CountriesRepository(IGenericReader reader, IGenericWriter writer) | ||||
|     : GenericRepository<Country>(reader, writer), ICountriesRepository | ||||
| { | ||||
|     protected override IQueryable<Country> LoadDomain() | ||||
|     { | ||||
|         return base.LoadDomain().Include(c => c.Cities); | ||||
|     } | ||||
| } | ||||
|  | ||||
|     async Task<Country?> ICountriesRepository.FindByName(string countryName, CancellationToken cancellationToken) | ||||
|     { | ||||
|         var result = await LoadDomain().SingleOrDefaultAsync(c => c.Name == countryName, cancellationToken); | ||||
|         return result; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user