public ActionResult Menu_Create(FormCollection form) { ResultBase_form result = new ResultBase_form(); WX_Menu m = new WX_Menu(); TryUpdateModel <WX_Menu>(m, form); m.CompanyID = UserDateTicket.Company.ID; switch (m.Type) { case 0: m.URL = ""; break; case 1: m.KeyWordID = Guid.Empty; break; case 2: m.URL = ""; m.KeyWordID = Guid.Empty; break; } if (m.ID == Guid.Empty) { result.status = WX_MenuService.instance().Insert(m); } else { result.status = WX_MenuService.instance().Update(m); } result.msg = result.status == 0 ? "操作失败" : "操作成功"; result.ResultURL = "/WeChat/Menu_Index"; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Menu_Create(string id) { WX_Menu m; if (string.IsNullOrEmpty(id)) { m = new WX_Menu(); } else { m = WX_MenuService.instance().Single(new Guid(id)); } return(View(m)); }
public JsonResult GetMenuPage(int pageIndex, int pageSize, string wheres, string sortorder, string sortname) { int totalcount = 0; IEnumerable <WX_Menu> datalist = WX_MenuService.instance().GetPageByDynamic(pageIndex, pageSize, out totalcount, sortname, sortorder, wheres); datalist.Each(m => { m.Childs = WX_MenuService.instance().GetChilds(m.ID); m.KeyWord = WX_KeyWordService.instance().GetEnumerableByID(m.KeyWordID).FirstOrDefault(); }); ResultBase_Page page = new ResultBase_Page(pageIndex, pageSize, totalcount); page.content = datalist.ToList(); return(Json(page, JsonRequestBehavior.AllowGet)); }
public JsonResult Menu_Delete(string id) { WX_Menu m = WX_MenuService.instance().Single(new Guid(id)); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("DR", !m.DR); if (WX_MenuService.instance().ModifColumn(dic, id)) { return(Json(new { status = 1, id = m.ID, dr = !m.DR }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = 0 }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetChileMenu(string id) { return(Json(WX_MenuService.instance().GetChilds(new Guid(id)), JsonRequestBehavior.AllowGet)); }
public JsonResult GetTopMenu() { return(Json(WX_MenuService.instance().GetTopEnumByCompanyID(UserDateTicket.Company.ID).Select(m => new { id = m.ID, name = m.Name }), JsonRequestBehavior.AllowGet)); }