public ActionResult Create(Menu menu) { if (ModelState.IsValid) { menu.Id = Guid.NewGuid(); db.Menus.Add(menu); db.SaveChanges(); return RedirectToAction("Index"); } return View(menu); }
public ActionResult Edit(Menu menu) { if (ModelState.IsValid) { db.Entry(menu).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(menu); }