public ActionResult EditMenuType(tb_MenuType entity) { if (ModelState.IsValid) { Dao.UpdateType(entity); } return(View(entity)); }
public ActionResult AddMenuType(tb_MenuType entity) { if (ModelState.IsValid) { long Id = Dao.InsertType(entity); return(RedirectToAction("EditMenuType", "Menus", new { Id = Id })); } return(View(entity)); }
public bool UpdateType(tb_MenuType entity) { try { db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public long InsertType(tb_MenuType entity) { db.tb_MenuType.Add(entity); db.SaveChanges(); return(entity.Id); }