From 4dfc50d5726dfae33cc0824ec03642ac06a9d5b5 Mon Sep 17 00:00:00 2001 From: "Tizian.Breuch" Date: Fri, 1 Aug 2025 15:17:14 +0200 Subject: [PATCH] naming --- .../Controllers/Admin/AdminCategorieController.cs | 6 +++--- .../Controllers/Public/CategorieController.cs | 4 ++-- Webshop.Application/DTOs/Categories/CategorieDto.cs | 2 +- Webshop.Application/DTOs/Products/ProductDto.cs | 2 +- .../Services/Admin/AdminCategorieService.cs | 12 ++++++------ .../Admin/Interfaces/IAdminCategorieService.cs | 6 +++--- .../Services/Public/CategorieService.cs | 8 ++++---- .../Services/Public/Interfaces/ICategorieService.cs | 4 ++-- .../Services/Public/ProductService.cs | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Webshop.Api/Controllers/Admin/AdminCategorieController.cs b/Webshop.Api/Controllers/Admin/AdminCategorieController.cs index c89da62..4b50ab0 100644 --- a/Webshop.Api/Controllers/Admin/AdminCategorieController.cs +++ b/Webshop.Api/Controllers/Admin/AdminCategorieController.cs @@ -22,14 +22,14 @@ namespace Webshop.Api.Controllers.Admin } [HttpGet] - public async Task>> GetAllcategories() + public async Task>> GetAllcategories() { var categories = await _admincategorieservice.GetAllAsync(); return Ok(categories); } [HttpGet("{id}")] - public async Task> GetcategorieById(Guid id) + public async Task> GetcategorieById(Guid id) { var categorie = await _admincategorieservice.GetByIdAsync(id); if (categorie == null) return NotFound(); @@ -37,7 +37,7 @@ namespace Webshop.Api.Controllers.Admin } [HttpPost] - public async Task> Createcategorie([FromBody] CreatecategorieDto categorieDto) + public async Task> Createcategorie([FromBody] CreatecategorieDto categorieDto) { if (!ModelState.IsValid) return BadRequest(ModelState); diff --git a/Webshop.Api/Controllers/Public/CategorieController.cs b/Webshop.Api/Controllers/Public/CategorieController.cs index 66352fe..d7fe773 100644 --- a/Webshop.Api/Controllers/Public/CategorieController.cs +++ b/Webshop.Api/Controllers/Public/CategorieController.cs @@ -21,14 +21,14 @@ namespace Webshop.Api.Controllers.Public } [HttpGet] - public async Task>> GetActivecategories() + public async Task>> GetActivecategories() { var categories = await _categorieservice.GetAllActiveAsync(); return Ok(categories); } [HttpGet("{slug}")] - public async Task> GetcategorieBySlug(string slug) + public async Task> GetcategorieBySlug(string slug) { var categorie = await _categorieservice.GetBySlugAsync(slug); if (categorie == null) return NotFound(); diff --git a/Webshop.Application/DTOs/Categories/CategorieDto.cs b/Webshop.Application/DTOs/Categories/CategorieDto.cs index 769a510..29a682f 100644 --- a/Webshop.Application/DTOs/Categories/CategorieDto.cs +++ b/Webshop.Application/DTOs/Categories/CategorieDto.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Webshop.Application.DTOs.categories { - public class categorieDto + public class CategorieDto { public Guid Id { get; set; } public string Name { get; set; } = string.Empty; diff --git a/Webshop.Application/DTOs/Products/ProductDto.cs b/Webshop.Application/DTOs/Products/ProductDto.cs index 5a43d4f..a2a7f20 100644 --- a/Webshop.Application/DTOs/Products/ProductDto.cs +++ b/Webshop.Application/DTOs/Products/ProductDto.cs @@ -19,6 +19,6 @@ namespace Webshop.Application.DTOs.Products public int StockQuantity { get; set; } public string? ImageUrl { get; set; } public string Slug { get; set; } = string.Empty; - public List categories { get; set; } = new List(); + public List categories { get; set; } = new List(); } } diff --git a/Webshop.Application/Services/Admin/AdminCategorieService.cs b/Webshop.Application/Services/Admin/AdminCategorieService.cs index 6cbba28..2cb78be 100644 --- a/Webshop.Application/Services/Admin/AdminCategorieService.cs +++ b/Webshop.Application/Services/Admin/AdminCategorieService.cs @@ -18,10 +18,10 @@ namespace Webshop.Application.Services.Admin _categorieRepository = categorieRepository; } - public async Task> GetAllAsync() + public async Task> GetAllAsync() { var categories = await _categorieRepository.GetAllAsync(); - return categories.Select(c => new categorieDto + return categories.Select(c => new CategorieDto { Id = c.Id, Name = c.Name, @@ -34,12 +34,12 @@ namespace Webshop.Application.Services.Admin }).ToList(); } - public async Task GetByIdAsync(Guid id) + public async Task GetByIdAsync(Guid id) { var categorie = await _categorieRepository.GetByIdAsync(id); if (categorie == null) return null; - return new categorieDto + return new CategorieDto { Id = categorie.Id, Name = categorie.Name, @@ -52,7 +52,7 @@ namespace Webshop.Application.Services.Admin }; } - public async Task<(categorieDto? Createdcategorie, string? ErrorMessage)> CreateAsync(CreatecategorieDto categorieDto) + public async Task<(CategorieDto? Createdcategorie, string? ErrorMessage)> CreateAsync(CreatecategorieDto categorieDto) { var existingcategorie = await _categorieRepository.GetBySlugAsync(categorieDto.Slug); if (existingcategorie != null) @@ -75,7 +75,7 @@ namespace Webshop.Application.Services.Admin await _categorieRepository.AddAsync(categorie); - var createdDto = new categorieDto + var createdDto = new CategorieDto { Id = categorie.Id, Name = categorie.Name, diff --git a/Webshop.Application/Services/Admin/Interfaces/IAdminCategorieService.cs b/Webshop.Application/Services/Admin/Interfaces/IAdminCategorieService.cs index 60b53cd..039476a 100644 --- a/Webshop.Application/Services/Admin/Interfaces/IAdminCategorieService.cs +++ b/Webshop.Application/Services/Admin/Interfaces/IAdminCategorieService.cs @@ -8,9 +8,9 @@ namespace Webshop.Application.Services.Admin { public interface IAdminCategorieService { - Task> GetAllAsync(); - Task GetByIdAsync(Guid id); - Task<(categorieDto? Createdcategorie, string? ErrorMessage)> CreateAsync(CreatecategorieDto categorieDto); + Task> GetAllAsync(); + Task GetByIdAsync(Guid id); + Task<(CategorieDto? Createdcategorie, string? ErrorMessage)> CreateAsync(CreatecategorieDto categorieDto); Task<(bool Success, string? ErrorMessage)> UpdateAsync(Guid id, CreatecategorieDto categorieDto); Task DeleteAsync(Guid id); } diff --git a/Webshop.Application/Services/Public/CategorieService.cs b/Webshop.Application/Services/Public/CategorieService.cs index 9404ad7..48a8bc2 100644 --- a/Webshop.Application/Services/Public/CategorieService.cs +++ b/Webshop.Application/Services/Public/CategorieService.cs @@ -16,14 +16,14 @@ namespace Webshop.Application.Services.Public _categorieRepository = categorieRepository; } - public async Task> GetAllActiveAsync() + public async Task> GetAllActiveAsync() { var categories = await _categorieRepository.GetAllAsync(); // Hier könnte man eine Baumstruktur aufbauen, für den Anfang eine flache Liste return categories .Where(c => c.IsActive) - .Select(c => new categorieDto + .Select(c => new CategorieDto { Id = c.Id, Name = c.Name, @@ -36,12 +36,12 @@ namespace Webshop.Application.Services.Public }).ToList(); } - public async Task GetBySlugAsync(string slug) + public async Task GetBySlugAsync(string slug) { var categorie = await _categorieRepository.GetBySlugAsync(slug); if (categorie == null || !categorie.IsActive) return null; - return new categorieDto + return new CategorieDto { Id = categorie.Id, Name = categorie.Name, diff --git a/Webshop.Application/Services/Public/Interfaces/ICategorieService.cs b/Webshop.Application/Services/Public/Interfaces/ICategorieService.cs index ee3e19a..56830f7 100644 --- a/Webshop.Application/Services/Public/Interfaces/ICategorieService.cs +++ b/Webshop.Application/Services/Public/Interfaces/ICategorieService.cs @@ -7,7 +7,7 @@ namespace Webshop.Application.Services.Public { public interface ICategorieService { - Task> GetAllActiveAsync(); - Task GetBySlugAsync(string slug); + Task> GetAllActiveAsync(); + Task GetBySlugAsync(string slug); } } \ No newline at end of file diff --git a/Webshop.Application/Services/Public/ProductService.cs b/Webshop.Application/Services/Public/ProductService.cs index 4524b2f..79f3945 100644 --- a/Webshop.Application/Services/Public/ProductService.cs +++ b/Webshop.Application/Services/Public/ProductService.cs @@ -41,7 +41,7 @@ namespace Webshop.Application.Services.Public ImageUrl = p.ImageUrl, IsInStock = p.IsInStock, Slug = p.Slug, - categories = p.Productcategories.Select(pc => new categorieDto + categories = p.Productcategories.Select(pc => new CategorieDto { Id = pc.categorie.Id, Name = pc.categorie.Name, @@ -73,7 +73,7 @@ namespace Webshop.Application.Services.Public ImageUrl = product.ImageUrl, IsInStock = product.IsInStock, Slug = product.Slug, - categories = product.Productcategories.Select(pc => new categorieDto + categories = product.Productcategories.Select(pc => new CategorieDto { Id = pc.categorie.Id, Name = pc.categorie.Name,