naming
This commit is contained in:
@@ -18,10 +18,10 @@ namespace Webshop.Application.Services.Public
|
||||
|
||||
public async Task<IEnumerable<CategoryDto>> GetAllActiveAsync()
|
||||
{
|
||||
var categories = await _categoryRepository.GetAllAsync();
|
||||
var categorys = await _categoryRepository.GetAllAsync();
|
||||
|
||||
// Hier könnte man eine Baumstruktur aufbauen, für den Anfang eine flache Liste
|
||||
return categories
|
||||
return categorys
|
||||
.Where(c => c.IsActive)
|
||||
.Select(c => new CategoryDto
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Webshop.Application.Services.Public
|
||||
{
|
||||
// Wir verwenden den DbContext, um Produkte und ihre Kategorien zu laden
|
||||
var products = await _context.Products
|
||||
.Include(p => p.ProductCategories) // Lade die Join-Tabelle
|
||||
.Include(p => p.Productcategorys) // Lade die Join-Tabelle
|
||||
.ThenInclude(pc => pc.Category) // Lade die zugehörige Kategorie-Entität
|
||||
.Where(p => p.IsActive) // Nur aktive Produkte
|
||||
.ToListAsync();
|
||||
@@ -41,7 +41,7 @@ namespace Webshop.Application.Services.Public
|
||||
ImageUrl = p.ImageUrl,
|
||||
IsInStock = p.IsInStock,
|
||||
Slug = p.Slug,
|
||||
Categories = p.ProductCategories.Select(pc => new CategoryDto
|
||||
categorys = p.Productcategorys.Select(pc => new CategoryDto
|
||||
{
|
||||
Id = pc.Category.Id,
|
||||
Name = pc.Category.Name,
|
||||
@@ -54,7 +54,7 @@ namespace Webshop.Application.Services.Public
|
||||
public async Task<ProductDto?> GetProductBySlugAsync(string slug)
|
||||
{
|
||||
var product = await _context.Products
|
||||
.Include(p => p.ProductCategories)
|
||||
.Include(p => p.Productcategorys)
|
||||
.ThenInclude(pc => pc.Category)
|
||||
.FirstOrDefaultAsync(p => p.Slug == slug && p.IsActive); // Nur aktives Produkt finden
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Webshop.Application.Services.Public
|
||||
ImageUrl = product.ImageUrl,
|
||||
IsInStock = product.IsInStock,
|
||||
Slug = product.Slug,
|
||||
Categories = product.ProductCategories.Select(pc => new CategoryDto
|
||||
categorys = product.Productcategorys.Select(pc => new CategoryDto
|
||||
{
|
||||
Id = pc.Category.Id,
|
||||
Name = pc.Category.Name,
|
||||
|
||||
Reference in New Issue
Block a user