public async Task UpdateProductAsync(CreateProductDTO product) { if (Get(product.Id) == null) { throw new Exception("Taki produkt nie istnieje"); } else { Shop.Core.Domain.Product model = new Shop.Core.Domain.Product(product.Id, product.Name, product.Description, product.Price, product.Quantity, product.CategoryId); await productRepository.UpdateProductAsync(model); } }
public async Task AddProduct(CreateProductDTO product) { var item = await Get(product.Id); if (item != null) { throw new Exception("Taki produkt już istnieje"); } else { Shop.Core.Domain.Product model = new Shop.Core.Domain.Product(product.Id, product.Name, product.Description, product.Price, product.Quantity, product.CategoryId); await productRepository.AddProduct(model); } }