public product create raus

This commit is contained in:
Tizian.Breuch
2025-07-23 09:11:18 +02:00
parent c8635756f1
commit af72dda917

View File

@@ -32,27 +32,5 @@ namespace Webshop.Application.Services.Public
ImageUrl = p.ImageUrl
}).ToList();
}
// Beispiel: Methode zum Erstellen eines Produkts (wenn PublicService auch Schreiben erlaubt)
// Normalerweise wäre das im AdminProductService
public async Task<ProductDto> CreateProductAsync(ProductDto productDto)
{
var newProduct = new Product
{
Id = Guid.NewGuid(),
Name = productDto.Name,
Description = productDto.Description,
SKU = productDto.SKU,
Price = productDto.Price,
IsActive = true, // Annahme
IsInStock = true, // Annahme
StockQuantity = productDto.StockQuantity,
ImageUrl = productDto.ImageUrl,
CreatedDate = DateTimeOffset.UtcNow,
};
await _productRepository.AddProductAsync(newProduct);
productDto.Id = newProduct.Id;
return productDto;
}
}
}