Ejemplo n.º 1
0
 /// <summary>
 /// 递归获取内容分组树结构
 /// </summary>
 /// <param name="root"></param>
 /// <param name="allContentsGroups"></param>
 private void GetContentsGroupTreeByRecursion(EContentsGroup root, IList<EContentsGroup> allContentsGroups)
 {
     //获取下一级菜单
     var children = allContentsGroups.Where(p => p.ContentsGroupParentId == root.Id).ToList();
     if (children.Count > 0)
     {
         root.Children = children;
         foreach (var sub in root.Children)
         {
             GetContentsGroupTreeByRecursion(sub, allContentsGroups);
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取所有内容分组 树
 /// </summary>
 /// <returns></returns>
 public EContentsGroup GetContentsGroupTree()
 {
     EContentsGroup root = new EContentsGroup() { Id = 0, ContentsGroupName = "分组" };
     IList<EContentsGroup> allContentsGroups = _rep.GetAll<EContentsGroup>(p => p.ContentsGroupOrderId.Asc());
     GetContentsGroupTreeByRecursion(root, allContentsGroups);
     return root;
 }
Ejemplo n.º 3
0
 public void SaveContentsGroup(EContentsGroup contentsGroup)
 {
     _rep.Save(contentsGroup, p => p.Id == contentsGroup.Id);
 }
Ejemplo n.º 4
0
 public void AddContentsGroup(EContentsGroup contentsGroup)
 {
     _rep.Add(contentsGroup);
 }