Пример #1
0
        internal ProductItemModel CreateCopy()
        {
            var copy = new ProductItemModel(Dish, Amount, ProductSize);

            foreach (var modifierCopy in modifiers.Select(modifier => modifier.CreateCopy()))
            {
                modifierCopy.Parent = copy;
                copy.modifiers.Add(modifierCopy);
            }

            return(copy);
        }
Пример #2
0
        private void ButtonAddProductItemClick(object sender, RoutedEventArgs e)
        {
            var selectedItem = lstProducts.SelectedItem;

            if (selectedItem == null)
            {
                return;
            }

            var selectedProduct  = (IProduct)selectedItem;
            var productItemModel = new ProductItemModel(selectedProduct, 1m, selectedProduct.Scale != null ? selectedProduct.Scale.DefaultSize : null);


            orderModel.AddProductItem(productItemModel);
        }
Пример #3
0
 internal void RemoveProductItem(ProductItemModel productItem)
 {
     productItem.Parent = null;
     products.Remove(productItem);
     RebuildItems();
 }
Пример #4
0
 internal void AddProductItem(ProductItemModel productItem)
 {
     productItem.Parent = this;
     products.Add(productItem);
     RebuildItems();
 }