naming
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace Webshop.Application.Services.Public
|
||||
_categorieRepository = categorieRepository;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<categorieDto>> GetAllActiveAsync()
|
||||
public async Task<IEnumerable<CategorieDto>> 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<categorieDto?> GetBySlugAsync(string slug)
|
||||
public async Task<CategorieDto?> 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,
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Webshop.Application.Services.Public
|
||||
{
|
||||
public interface ICategorieService
|
||||
{
|
||||
Task<IEnumerable<categorieDto>> GetAllActiveAsync();
|
||||
Task<categorieDto?> GetBySlugAsync(string slug);
|
||||
Task<IEnumerable<CategorieDto>> GetAllActiveAsync();
|
||||
Task<CategorieDto?> GetBySlugAsync(string slug);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user