示例#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);
            }
        }