public void InitData() { var product1 = new Product {Name = "Chomik"}; session.Store(product1); session.SaveChanges(); }
public void AddToCart(Product p, int count) { var entry = this.Products.SingleOrDefault(x => x.Product.Id == p.Id); if (entry != null) { entry.Count += count; } else { Products.Add(new CartEntry(p, count)); } }
public CartEntry(Product product, int count) { this.product = product; this.Count = count; }