public async Task <ProductId> CreateAsync(UncreatedProduct product) { var nameAlreadyExists = await _repository.NameExistsAsync(product.Name); if (nameAlreadyExists) { throw new ProductNameAlreadyExistsException(product.Name); } return(await _createProduct.CreateAsync(product)); }
public async Task CreateAsync(UncreatedProduct product) { await Task.CompletedTask; var newProduct = new Product( new ProductId(_idGenerator.NewId()), product.Name, product.Description, product.Dimension, product.Weight, product.CategoryIds); _products.Add(newProduct); }