internal StockItem FindStockItem(Stock stock, Unit unit, RecipeableItem recipeableItem, bool createIfNotExists) { if (recipeableItem == null) throw new ArgumentNullException("recipeableItem"); if (unit == null) throw new ArgumentNullException("unit"); var stockItem = stock.StockItems.Where(x => x.RecipeableItem == recipeableItem).FirstOrDefault(); if (stockItem == null) { if( !createIfNotExists ) throw new InvalidOperationException(); stockItem = new StockItem { RecipeableItem = recipeableItem, Unit = unit }; stock.AddStockItem(stockItem); } return stockItem; }
public SingleStockItemViewModel(StockItem editStockItem) { _editStockItem = new EditStockItem(editStockItem); }
public EditStockItem(StockItem stockItem) { StockItem = stockItem; }
public virtual void RemoveStockItem(StockItem stockItem) { _stockItems.Remove(stockItem); }
public virtual void AddStockItem(StockItem stockItem) { stockItem.Stock = this; _stockItems.Add(stockItem); }