Esempio n. 1
0
 public ActionResult Edit(MenuItem item)
 {
     _context.MenuItems.Attach(item);
     _context.Entry(item).State = System.Data.Entity.EntityState.Modified;
     _context.SaveChanges();
     return(RedirectToAction("Items", new { isAdmin = true }));
 }
 public ActionResult Edit(MenuItem model)
 {
     try
     {
         db.Entry <MenuItem>(model).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         ModelState.AddModelError("", "Invalid Operation");
         return(View("Index"));
     }
 }