private Ingredient(IngredientId id, string name, WholesalerId wholesalerId, decimal price, PurchaseAmount purchaseAmount) { this._id = id ?? throw new ArgumentNullException(nameof(id)); this._name = name ?? throw new ArgumentNullException(nameof(name)); this._wholesalerId = wholesalerId ?? throw new ArgumentNullException(nameof(wholesalerId)); this._purchaseAmount = purchaseAmount ?? throw new ArgumentNullException(nameof(purchaseAmount)); this._monthlyProperyYearlySet = new YearlySet <IngredientMonthlyProperty>(); }
private Wholesaler(WholesalerId id, string name, string personInCharge, string contact, IList <IngredientId> goods) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("wholesaler name is required", nameof(name)); } this._id = id ?? throw new ArgumentNullException(nameof(id)); this._name = name; this._personInCharge = personInCharge; this._contact = contact; this._goods = goods ?? new List <IngredientId>(); }
public static Ingredient UseNewIngredient(string name, WholesalerId wholesalerId, decimal price, PurchaseAmount purchaseAmount) { return(new Ingredient(IngredientIdRepository.NextIdentifier(), name, wholesalerId, price, purchaseAmount)); }