// //helper public int ConvertMenuCode(T_ZC_Menu menu) { if(menu.ParentID.ToString() != "") { return menu.ParentID; } return 0; }
public ActionResult Create(T_ZC_Menu t_zc_menu) { if (Request.IsAjaxRequest()) { if (ModelState.IsValid) { t_zc_menu.CreatedAt = DateTime.Now; t_zc_menu.UpdatedAt = DateTime.Now; t_zc_menu.IsValid = true; db.T_ZC_Menu.Add(t_zc_menu); int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "menuInfoBox", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } } ViewBag.SystemID = new SelectList(db.T_ZC_System.Where(p => p.IsValid == true), "ID", "Name",t_zc_menu.SystemID); ViewBag.ParentID = new SelectList(db.T_ZC_Menu.Where(p => p.IsValid == true), "ID", "Name", t_zc_menu.ParentID); return Json(new { }); }