public static ProductModel GetProductAsModel(Guid id) { var product = GetProduct(id); var productModel = new ProductModel(product); return productModel; }
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); } }