private Product(ProductId productId, string code) : base(productId) { if (string.IsNullOrWhiteSpace(code)) { throw CoreException.NullOrEmptyArgument(nameof(code)); } this.Code = code; }
public Product ChangeName(string productName) { if (string.IsNullOrWhiteSpace(productName)) { throw CoreException.NullOrEmptyArgument(nameof(productName)); } this.Name = productName; return(this); }
public Inventory ChangeLocation(string location) { if (string.IsNullOrWhiteSpace(location)) { throw CoreException.NullOrEmptyArgument(nameof(location)); } this.Location = location; return(this); }
public Inventory ChangeName(string name) { if (string.IsNullOrWhiteSpace(name)) { throw CoreException.NullOrEmptyArgument(nameof(name)); } this.Name = name; return(this); }
private Inventory(InventoryId inventoryId, string name, string location) : base(inventoryId) { if (string.IsNullOrWhiteSpace(name)) { throw CoreException.NullOrEmptyArgument(nameof(name)); } if (string.IsNullOrWhiteSpace(location)) { throw CoreException.NullOrEmptyArgument(nameof(location)); } this.Name = name; this.Location = location; }
public ProductInventory WithInventory(Inventory inventory, int quantity, bool canPurchase = true) { if (inventory == null) { throw CoreException.NullOrEmptyArgument(nameof(inventory)); } if (this._inventories.Any(x => x.Inventory == inventory)) { throw new CoreException($"{this} is existing in {inventory}"); } var productInventory = ProductInventory.Create(this, inventory, quantity, canPurchase); this._inventories.Add(productInventory); return(productInventory); }
private ProductInventory(ProductInventoryId productInventoryId, Product product, Inventory inventory, int quantity, bool canPurchase = true) : base(productInventoryId) { if (product == null) { throw CoreException.NullOrEmptyArgument(nameof(product)); } if (inventory == null) { throw CoreException.NullOrEmptyArgument(nameof(inventory)); } this.Product = product; this.Inventory = inventory; this.Quantity = quantity; this.CanPurchase = canPurchase; }