public ActionResult Create(FormCollection collection,string Name) { try { // TODO: Add insert logic here CategoryModel cm = new CategoryModel(); cm.Name = Name; CategoryDB.InsertCategory(cm); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Index(FormCollection collection) { CategoryModel cm = new CategoryModel(); cm.Name = collection["Category"]; CategoryDB.InsertCategory(cm); return RedirectToAction("Index"); }