Beispiel #1
0
 public IActionResult Delete(int accountId, int id)
 {
     try
     {
         fileRepository.Delete(id);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(HandleException(ex));
     }
 }
        public ActionResult DeleteFile(string path)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            var image = files.ImageByPath(path);
            if (image != null)
            {
                files.Delete(image);
                return Content("");
            }
            throw new HttpException(404, "File Not Found");
        }
 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");
 }
Beispiel #4
0
        public ActionResult DeleteDirectory(string path)
        {
            //TODO:Add security checks

            var files  = new FilesRepository();
            var folder = files.GetFolderByPath(path);

            if (folder != null)
            {
                files.Delete(folder);
                return(Content(""));
            }
            throw new HttpException(404, "File Not Found");
        }
Beispiel #5
0
        public ActionResult DeleteFile(string path)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            var image = files.ImageByPath(path);

            if (image != null)
            {
                files.Delete(image);
                return(Content(""));
            }
            throw new HttpException(404, "File Not Found");
        }
        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");
        }
        public ActionResult DeleteDirectory(string path)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            var folder = files.GetFolderByPath(path);
            if (folder != null)
            {
                files.Delete(folder);
                return Content("");
            }
            throw new HttpException(404, "File Not Found");
        }