public ActionResult BigTreeWithAjaxAutoComplete() { List<Node> _lstTreeNodes; using (EFContext.SharkTreeTestEntities context = new EFContext.SharkTreeTestEntities()) { _lstTreeNodes = context.TreeData.Select(x => new Node() { Id = x.ID.ToString(), Term = x.Term, ParentId = x.ParentId == 0 ? string.Empty : x.ParentId.ToString() }).ToList(); } ViewBag.SharkTreeData = _lstTreeNodes; return View(); }
public string GetBySample(string q) { List<Node> listTree = new List<Node>(); using (EFContext.SharkTreeTestEntities context = new EFContext.SharkTreeTestEntities()) { listTree = context .TreeData.Where(x => x.Term.ToLower().StartsWith(q)) .Select(x => new Node() { Id = x.ID.ToString(), Term = x.Term, ParentId = x.ParentId == 0 ? string.Empty : x.ParentId.ToString() }).ToList(); } string resultJson = new JavaScriptSerializer().Serialize(listTree); return resultJson; }
public ActionResult BigTree() { List <Node> _lstTreeNodes; using (EFContext.SharkTreeTestEntities context = new EFContext.SharkTreeTestEntities()) { _lstTreeNodes = context.TreeData.Select(x => new Node() { Id = x.ID.ToString(), Term = x.Term, ParentId = x.ParentId == 0 ? string.Empty : x.ParentId.ToString() }).ToList(); } ViewBag.SharkTreeData = _lstTreeNodes; return(View()); }
public string GetBySample(string q) { List <Node> listTree = new List <Node>(); using (EFContext.SharkTreeTestEntities context = new EFContext.SharkTreeTestEntities()) { listTree = context .TreeData.Where(x => x.Term.ToLower().StartsWith(q)) .Select(x => new Node() { Id = x.ID.ToString(), Term = x.Term, ParentId = x.ParentId == 0 ? string.Empty : x.ParentId.ToString() }).ToList(); } string resultJson = new JavaScriptSerializer().Serialize(listTree); return(resultJson); }