コード例 #1
0
        public static TreeNodeModel ProjectToTreeItemModel(ProjectModel o)
        {
            var node = DirectoryModelUtils.DirectoryToTreeItemModel(o, null, o.Structure, 0);

            node.Structure   = o.Structure;
            node.Level       = 0;
            node.Type        = o.Type;
            node.Description = o.Description;
            node.expanded    = true;
            return(node);
        }
コード例 #2
0
        public static async Task <ProjectModel> CreateProjectModelAsync(Project project, bool read = false, IEnumerable <SheetTemplate> templates = null)
        {
            var model = new ProjectModel {
                Url           = project.Url,
                Name          = project.Name,
                Items         = new List <ItemModel>(),
                Discriminator = Discriminator.Directory,
                Index         = project.Index,
                Key           = project.Key,
                Structure     = project.GetStructure(),
                Type          = (int)project.Type,
                Description   = project.Description,
            };
            var dirModel = await DirectoryModelUtils.CreateDirectoryModelAsync(project, read);

            model.Items = (dirModel as DirectoryModel).Items;
            if (templates != null)
            {
                model.Templates = templates.Select(o => SheetModelUtils.GetModel(o, true, true, true)).ToList();
            }
            return(model);
        }