Beispiel #1
0
 void Fill(List <PermissionModel> container, List <Sys_Permission> permissions, int level)
 {
     foreach (var permission in permissions)
     {
         container.Add(PermissionModel.Create(permission, level));
         Fill(container, permission.Children, level + 1);
     }
 }
Beispiel #2
0
        public static PermissionModel Create(Sys_Permission entity, int level = 0)
        {
            PermissionModel ret = new PermissionModel()
            {
                Id = entity.Id, Name = entity.Name
            };

            for (int i = 0; i < level; i++)
            {
                ret.Name = " " + ret.Name;
            }

            return(ret);
        }