Ejemplo n.º 1
0
 /// <summary>
 /// 查询版块下所有分类
 /// </summary>
 /// <param name="selected">选中项</param> 
 protected IList<SelectListItem> QueryCategoryAll(string selected = null)
 {
     string resultMsg = string.Empty;
     LogicCategory dalCategory = new LogicCategory();
     var list = dalCategory.CategoryAllThree(out resultMsg, ParentCateg: 0);
     var slist = (from ModelCategory model in list
                  select new SelectListItem()
                  {
                      Selected = model.Id.ToString().Equals(selected) ? true : false,
                      Text = model.Name,
                      Value = model.Id.ToString()
                  }).ToList();
     return slist;
 }
Ejemplo n.º 2
0
        public ActionResult Tree(FormCollection fc)
        {
            string resultMsg = string.Empty;
            LogicCategory logic = new LogicCategory();
            var list = logic.CategoryAllThree(out resultMsg, ParentCateg: 0);

            var listTree = (from ModelCategory model in list
                            select new ModelTree() {
                                id = model.Id.ToString(),
                                name = model.Name,
                                pId = model.Parentcateg.ToString() }).ToList();

            return Json(listTree);
        }