Ejemplo n.º 1
0
 public ActionResult Create(string path, FileBrowserEntry entry)
 {
     if (entry.EntryType == FileBrowserEntryType.Directory)
     {
         BuildPath(path, out folderPath, out resourcePath);
         var folder = session.OpenFolder(folderPath + "/");
         var cFolder = folder.CreateFolder(entry.Name);
     }
     return Json(new { Name = entry.Name, Size = entry.Size, EntryType = (int)entry.EntryType });
 }
 public ActionResult Create(string path, FileBrowserEntry entry)
 {
     var files = new FilesRepository();
     var folder = files.GetFolderByPath(path);
     if (folder != null)
     {
         files.CreateDirectory(folder, entry.Name);
         return Json(new object[0]);
     }
     throw new HttpException(403, "Forbidden");
 }
Ejemplo n.º 3
0
 public ActionResult Destroy(string path, FileBrowserEntry entry)
 {
     BuildPath(path, out folderPath, out resourcePath);
     if (entry.EntryType == FileBrowserEntryType.Directory)
     {
         var target = folderPath + "/" + entry.Name + "/";
         var folder = session.OpenFolder(target + "/");
         (folder as WebDavFolder).SetHref(target, new Uri(target));
         folder.Delete();
     }
     else if (entry.EntryType == FileBrowserEntryType.File)
     {
         var folder = session.OpenFolder(folderPath + "/");
         var resource = folder.GetResource(resourcePath + entry.Name);
         resource.Delete();
     }
     return Json("");
 }
 public ActionResult Destroy(string path, FileBrowserEntry entry)
 {
     var files = new FilesRepository();
     if (entry.EntryType == FileBrowserEntryType.File)
     {
         var image = files.ImageByPath(Path.Combine(path, entry.Name));
         if (image != null)
         {
             files.Delete(image);
             return Json(new object[0]);
         }
     } else 
     {
         var folder = files.GetFolderByPath(Path.Combine(path, entry.Name));
         if (folder != null)
         {
             files.Delete(folder);
             return Json(new object[0]);
         }
     } 
     throw new HttpException(404, "File Not Found");
 }