public ActionResult Add(Product productModel) { if (ModelState.IsValid) { DocumentSession.Store(productModel); return RedirectToAction("Index"); } return View(productModel); }
public ActionResult Edit(Product productModel) { if (ModelState.IsValid) { var product = DocumentSession.Load<Product>(productModel.Id); product.Title = productModel.Title; product.Description = productModel.Description; product.Price = productModel.Price; product.Featured = productModel.Featured; return RedirectToAction("Index"); } return View("Add", productModel); }