public void AddItem(Product p, ProductChars pchar, string shk, double q, string cutting, double price) { this._cartLines.Add(new CartLine() { Product = p, ProductChar = pchar, Shk = shk, Quantity = q, Price = price, Cutting = cutting, Id = Guid.NewGuid() }); }
public void AddItem(ProductChars pchar, double q, string cutting) { Product product; using (DataContext dataContext = new DataContext()) product = dataContext.Products.Where <Product>((Expression <Func <Product, bool> >)(pr => pr.Id == pchar.ProductId)).FirstOrDefault <Product>(); this._cartLines.Add(new CartLine() { Product = product, ProductChar = pchar, Quantity = q, Cutting = cutting }); }