private JObject GetCategory(EqtCategory cate) { var json = new JObject(); json["id"] = cate.Id; json["name"] = cate.Name; return(json); }
private ComboTreeModel GetTree(EqtCategory parent, IEnumerable <EqtCategory> items) { var tree = new ComboTreeModel { id = parent.Id, text = parent.Name, children = items.Where(t => t.Pid == parent.Id).Select(t => GetTree(t, items)).ToArray() }; return(tree); }
public bool Modify(EqtCategory cate, Expression <Func <EqtCategory, bool> > predicate) { var count = Handler.ModifyAny( m => { m.Code = cate.Code; m.HitCount = cate.HitCount; m.Name = cate.Name; m.Pid = cate.Pid; return(m); }, predicate, true).Count(); return(0 < count); }
public JsonResult FormSubmit(string id, string name, string code, short hits, string parentId) { var module = new EqtTypeModule(CurrentUser); var cate = new EqtCategory { Code = code, HitCount = hits, Name = name, Pid = parentId }; var data = false; if (string.IsNullOrWhiteSpace(id)) { data = module.Add(cate); } else { cate.Id = id; data = module.Modify(cate, t => t.Id == id); } return(Json(new { code = 0, msg = "Ok", data = data }, "text/html")); }
public bool Add(EqtCategory cate) { return (null != Handler.Add(cate, true)); }