private void ResetFolder(ContentFolder folder) { folder.Folders.Clear(); folder.Files.Clear(); var path = ContentLib.GetRootPath() + folder.FullName.TrimStart('\\'); if (System.IO.Directory.Exists(path)) { foreach (var f in System.IO.Directory.GetDirectories(path)) { var newItem = ContentLib.CreateFolder(folder); newItem.Name = f.Substring(f.LastIndexOf('\\') + 1); newItem.Description = "自动加载"; ResetFolder(newItem); } foreach (var f in System.IO.Directory.GetFiles(path)) { var newItem = ContentLib.CreateFile(folder); newItem.Name = f.Substring(f.LastIndexOf('\\') + 1); newItem.Description = "自动加载"; } } }
public ActionResult Edit(long id) { var lib = new ContentLib(); var content = lib.GetByID(id); SetViewBag(content.CategoryID); return(View()); }