public ActionResult Create(Product product) { //Product p = new Product(); //foreach (var item in Request.Form) //{ // var i = (KeyValuePair<string, string>)item; // if (i.Key == "Name") // p.Name = i.Value; // if (i.Key == "Price") // p.Price = decimal.Parse(i.Value); //} try { // TODO: Add insert logic here return RedirectToAction("Index"); } catch { return View(); } }
// GET: Products/Create public ActionResult Create() { Product product = new Product(); return View(product); }