Пример #1
0
        public static ProductModel GetProductAsModel(Guid id)
        {
            var product = GetProduct(id);
            var productModel = new ProductModel(product);

            return productModel;
        }
Пример #2
0
        public void AddLineItem(ProductModel productModel)
        {
            bool found = false;
            foreach (var item in GetLineItems())
            {
                if (item.Item.Id == productModel.Id)
                {
                    item.Quantity++;
                    found = true;

                    break;
                }
            }

            if (!found)
            {
                var newLineItem = new OrderItemModel
                {
                    Item = productModel,
                    Quantity = 1,
                };
                _LineItems.Add(newLineItem);
            }
        }