This commit is contained in:
Tizian.Breuch
2025-08-01 15:17:14 +02:00
parent 90171fffa2
commit 4dfc50d572
9 changed files with 24 additions and 24 deletions

View File

@@ -18,10 +18,10 @@ namespace Webshop.Application.Services.Admin
_categorieRepository = categorieRepository;
}
public async Task<IEnumerable<categorieDto>> GetAllAsync()
public async Task<IEnumerable<CategorieDto>> 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<categorieDto?> GetByIdAsync(Guid id)
public async Task<CategorieDto?> 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,

View File

@@ -8,9 +8,9 @@ namespace Webshop.Application.Services.Admin
{
public interface IAdminCategorieService
{
Task<IEnumerable<categorieDto>> GetAllAsync();
Task<categorieDto?> GetByIdAsync(Guid id);
Task<(categorieDto? Createdcategorie, string? ErrorMessage)> CreateAsync(CreatecategorieDto categorieDto);
Task<IEnumerable<CategorieDto>> GetAllAsync();
Task<CategorieDto?> GetByIdAsync(Guid id);
Task<(CategorieDto? Createdcategorie, string? ErrorMessage)> CreateAsync(CreatecategorieDto categorieDto);
Task<(bool Success, string? ErrorMessage)> UpdateAsync(Guid id, CreatecategorieDto categorieDto);
Task<bool> DeleteAsync(Guid id);
}