public ActionResult Create(Product product) { try { _session.Store(product); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult StoreSomeProductInDatabase() { var product = new Product { Name = "Product Name", CategoryId = "category/1024", SupplierId = "supplier/16", Code = "H11050", StandardCost = 250, ListPrice = 189 }; _session.Store(product); _session.SaveChanges(); //return Content(product.Id); return RedirectToAction("Index"); }
// // GET: /Product/Create public ActionResult Create() { var model = new Product(); return View(model); }
public ActionResult InsertSomeMoreProducts() { for (int i = 0; i < 50; i++) { var product = new Product { Name = "Product Name " + i, CategoryId = "category/1024", SupplierId = "supplier/16", Code = "H11050" + i, StandardCost = 250 + (i*10), ListPrice = 189 + (i*10), }; _session.Store(product); } _session.SaveChanges(); //return Content("Products successfully created"); return RedirectToAction("Index"); }