Inheritance: DomainEntity
Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public SingleStockItemViewModel(StockItem editStockItem)
 {
     _editStockItem = new EditStockItem(editStockItem);
 }
Ejemplo n.º 3
0
 public EditStockItem(StockItem stockItem)
 {
     StockItem = stockItem;
 }
Ejemplo n.º 4
0
 public virtual void RemoveStockItem(StockItem stockItem)
 {
     _stockItems.Remove(stockItem);
 }
Ejemplo n.º 5
0
 public virtual void AddStockItem(StockItem stockItem)
 {
     stockItem.Stock = this;
     _stockItems.Add(stockItem);
 }