상속: DomainEntity
예제 #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;
        }
예제 #2
0
 public SingleStockItemViewModel(StockItem editStockItem)
 {
     _editStockItem = new EditStockItem(editStockItem);
 }
예제 #3
0
 public EditStockItem(StockItem stockItem)
 {
     StockItem = stockItem;
 }
예제 #4
0
파일: Stock.cs 프로젝트: Slesa/Playground
 public virtual void RemoveStockItem(StockItem stockItem)
 {
     _stockItems.Remove(stockItem);
 }
예제 #5
0
파일: Stock.cs 프로젝트: Slesa/Playground
 public virtual void AddStockItem(StockItem stockItem)
 {
     stockItem.Stock = this;
     _stockItems.Add(stockItem);
 }