try
This commit is contained in:
17
Webshop.Application/Services/Public/CategoryService.cs
Normal file
17
Webshop.Application/Services/Public/CategoryService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Webshop.Application.Services.Public
|
||||
{
|
||||
public class CategoryService : ICategoryService
|
||||
{
|
||||
// Fügen Sie hier Abhängigkeiten per Dependency Injection hinzu (z.B. Repositories)
|
||||
|
||||
// public CategoryService(IYourRepository repository) { }
|
||||
|
||||
// Fügen Sie hier Service-Methoden hinzu
|
||||
}
|
||||
}
|
||||
16
Webshop.Application/Services/Public/ICategoryService.cs
Normal file
16
Webshop.Application/Services/Public/ICategoryService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs;
|
||||
using Webshop.Application.DTOs.Auth;
|
||||
using Webshop.Application.DTOs.Users;
|
||||
|
||||
|
||||
namespace Webshop.Application.Services.Public
|
||||
{
|
||||
public interface ICategoryService
|
||||
{
|
||||
// Fügen Sie hier Methodensignaturen hinzu
|
||||
}
|
||||
}
|
||||
14
Webshop.Application/Services/Public/IProductService.cs
Normal file
14
Webshop.Application/Services/Public/IProductService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
// src/Webshop.Application/Services/Public/IProductService.cs
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs; // ProductDto
|
||||
|
||||
namespace Webshop.Application.Services.Public
|
||||
{
|
||||
public interface IProductService
|
||||
{
|
||||
Task<IEnumerable<ProductDto>> GetAllProductsAsync();
|
||||
// Task<ProductDto?> GetProductByIdAsync(Guid id); // Wenn Sie eine einzelne öffentliche Produktansicht brauchen
|
||||
// Task<ProductDto> CreateProductAsync(ProductDto productDto); // Nur wenn Public Service auch Erstellung erlaubt
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
// src/Webshop.Application/Services/Public/ProductService.cs
|
||||
using Webshop.Application.DTOs; // ProductDto
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs;
|
||||
using Webshop.Domain.Interfaces;
|
||||
using System.Collections.Generic; // Sicherstellen, dass für IEnumerable vorhanden
|
||||
using Webshop.Domain.Entities;
|
||||
|
||||
|
||||
namespace Webshop.Application.Services.Public
|
||||
{
|
||||
public class ProductService // Sie haben den Namen "ProductService" beibehalten
|
||||
public class ProductService : IProductService
|
||||
{
|
||||
private readonly IProductRepository _productRepository;
|
||||
|
||||
@@ -15,22 +18,9 @@ namespace Webshop.Application.Services.Public
|
||||
_productRepository = productRepository;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProductDto>> GetAllProductsAsync()
|
||||
{
|
||||
var productsFromDb = await _productRepository.GetAllProductsAsync();
|
||||
|
||||
return productsFromDb.Select(p => new ProductDto
|
||||
{
|
||||
Id = p.Id,
|
||||
Name = p.Name,
|
||||
Description = p.Description,
|
||||
Price = p.Price,
|
||||
SKU = p.SKU,
|
||||
IsActive = p.IsActive,
|
||||
IsInStock = p.IsInStock,
|
||||
StockQuantity = p.StockQuantity,
|
||||
ImageUrl = p.ImageUrl
|
||||
}).ToList();
|
||||
}
|
||||
// HIER KOMMT DER VORHERIGE PRODUCTSERVICE CODE HIN (GetAllProductsAsync, CreateProductAsync etc.)
|
||||
// Hier sind Platzhalter-Implementierungen, die Sie durch den vollständigen Code ersetzen müssen:
|
||||
public async Task<IEnumerable<ProductDto>> GetAllProductsAsync() { return new List<ProductDto>(); }
|
||||
public async Task<ProductDto> CreateProductAsync(ProductDto productDto) { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user