/// <summary> /// Populates the folder with folders. /// </summary> /// <param name="folder">The folder.</param> /// <param name="children">The children.</param> private void PopulateFolderWithFolders(UmbracoFolderModel folder, ConcurrentBag <IMedia> children) { if (children.Any(p => p.ContentType.Alias == MediaTypeAlias.Folder)) { var childrenFolders = children.BuildFolderModels(UserService); folder.Folders.AddRange(childrenFolders); } }
/// <summary> /// Builds the root folder. /// </summary> /// <param name="rootMedia">The root media.</param> /// <returns></returns> private UmbracoFolderModel BuildRootFolder(ConcurrentBag <IMedia> rootMedia) { var images = rootMedia.BuildImageModels(UserService); var folders = rootMedia.BuildFolderModels(UserService); var rootFolder = new UmbracoFolderModel(folders.ToList(), images.ToList()); return(rootFolder); }