diff --git a/ShopSolution.sln b/ShopSolution.sln index 8eabfe1..e842a86 100644 --- a/ShopSolution.sln +++ b/ShopSolution.sln @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.10.35122.118 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webshop.Api", "Webshop.Api\Webshop.Api.csproj", "{CFC6D39C-5455-4091-8831-A07E34E1EF5F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Api", "Webshop.Api\Shop.Api.csproj", "{CFC6D39C-5455-4091-8831-A07E34E1EF5F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webshop.Domain", "Webshop.Domain\Webshop.Domain.csproj", "{959C9FF8-13B2-43AD-9795-878D497EB975}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Domain", "Webshop.Domain\Shop.Domain.csproj", "{959C9FF8-13B2-43AD-9795-878D497EB975}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webshop.Application", "Webshop.Application\Webshop.Application.csproj", "{48E0F59D-F70D-4AA7-895C-671AD939A4B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Application", "Webshop.Application\Shop.Application.csproj", "{48E0F59D-F70D-4AA7-895C-671AD939A4B9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webshop.Infrastructure", "Webshop.Infrastructure\Webshop.Infrastructure.csproj", "{546165FB-7B73-40A5-B774-15CEDFEBB9E8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shop.Infrastructure", "Webshop.Infrastructure\Shop.Infrastructure.csproj", "{546165FB-7B73-40A5-B774-15CEDFEBB9E8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Webshop.Api/Webshop.Api.csproj b/Webshop.Api/Shop.Api.csproj similarity index 84% rename from Webshop.Api/Webshop.Api.csproj rename to Webshop.Api/Shop.Api.csproj index 5fa4bdb..dfba4f9 100644 --- a/Webshop.Api/Webshop.Api.csproj +++ b/Webshop.Api/Shop.Api.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/Webshop.Application/Webshop.Application.csproj b/Webshop.Application/Shop.Application.csproj similarity index 83% rename from Webshop.Application/Webshop.Application.csproj rename to Webshop.Application/Shop.Application.csproj index 2e530f3..521953a 100644 --- a/Webshop.Application/Webshop.Application.csproj +++ b/Webshop.Application/Shop.Application.csproj @@ -11,7 +11,7 @@ - + diff --git a/Webshop.Domain/Interfaces/IProductRepository.cs b/Webshop.Domain/Interfaces/IProductRepository.cs index 878c86c..84e944b 100644 --- a/Webshop.Domain/Interfaces/IProductRepository.cs +++ b/Webshop.Domain/Interfaces/IProductRepository.cs @@ -10,5 +10,6 @@ namespace Webshop.Domain.Interfaces Task AddProductAsync(Product product); Task UpdateProductAsync(Product product); Task DeleteProductAsync(Guid id); + Task ProductExistsBySlugAsync(string slug); } } \ No newline at end of file diff --git a/Webshop.Domain/Webshop.Domain.csproj b/Webshop.Domain/Shop.Domain.csproj similarity index 100% rename from Webshop.Domain/Webshop.Domain.csproj rename to Webshop.Domain/Shop.Domain.csproj diff --git a/Webshop.Infrastructure/Repositories/ProductRepository.cs b/Webshop.Infrastructure/Repositories/ProductRepository.cs index fae5337..05bc589 100644 --- a/Webshop.Infrastructure/Repositories/ProductRepository.cs +++ b/Webshop.Infrastructure/Repositories/ProductRepository.cs @@ -28,8 +28,13 @@ namespace Webshop.Infrastructure.Repositories public async Task AddProductAsync(Product product) { - _context.Products.Add(product); - await _context.SaveChangesAsync(); // Wichtig: Änderungen speichern + await _context.Products.AddAsync(product); + await _context.SaveChangesAsync(); + } + + public async Task ProductExistsBySlugAsync(string slug) + { + return await _context.Products.AnyAsync(p => p.Slug == slug); } public async Task UpdateProductAsync(Product product) diff --git a/Webshop.Infrastructure/Webshop.Infrastructure.csproj b/Webshop.Infrastructure/Shop.Infrastructure.csproj similarity index 89% rename from Webshop.Infrastructure/Webshop.Infrastructure.csproj rename to Webshop.Infrastructure/Shop.Infrastructure.csproj index 07beb5a..263b216 100644 --- a/Webshop.Infrastructure/Webshop.Infrastructure.csproj +++ b/Webshop.Infrastructure/Shop.Infrastructure.csproj @@ -17,9 +17,7 @@ - + - -