public ActionResult New(Product product) { if (!ModelState.IsValid) return View(product); _productRepository.Create(product); return RedirectToAction("index"); }
public void Create(Product product) { using (var session = _db.OpenSession()) { session.Store(product, product.Title); session.SaveChanges(); } }
public void ShoppingCartAddingSameProductIncreasesQuantity() { var cart = new ShoppingCart(); var product = new Product(); cart.Add(product); cart.Add(product); var item = cart.Items.Single(x => x.Product == product); Assert.AreEqual(2, item.Quantity); }
public void Update(Product product) { Create(product); }