public product create raus
This commit is contained in:
@@ -32,27 +32,5 @@ namespace Webshop.Application.Services.Public
|
|||||||
ImageUrl = p.ImageUrl
|
ImageUrl = p.ImageUrl
|
||||||
}).ToList();
|
}).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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user