Ejemplo n.º 1
0
        public JsonResult Browse(string path)
        {
            //TODO:Add security checks

            var          files = new FilesRepository();
            BrowseResult result;

            if (string.IsNullOrEmpty(path) || path == "/")
            {
                var root     = files.GetRootFolder();
                var rootPath = VirtualPathUtility.AppendTrailingSlash(root != null ? root.Name : string.Empty);
                result = new BrowseResult
                {
                    Files        = files.Images(root),
                    Directories  = files.Folders(root),
                    Path         = rootPath,
                    ContentPaths = new[] { rootPath }
                };
            }
            else
            {
                result = new BrowseResult
                {
                    Files        = files.Images(path),
                    Directories  = files.Folders(path),
                    Path         = VirtualPathUtility.AppendTrailingSlash(path),
                    ContentPaths = new[] { VirtualPathUtility.AppendTrailingSlash(path) }
                };
            }
            return(Json(result));
        }
        public JsonResult Browse(string path)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            BrowseResult result;
            if (string.IsNullOrEmpty(path) || path == "/")
            {
                var root = files.GetRootFolder();
                var rootPath = VirtualPathUtility.AppendTrailingSlash(root != null ? root.Name : string.Empty);
                result = new BrowseResult
                             {
                                 Files = files.Images(root),
                                 Directories = files.Folders(root),
                                 Path = rootPath,
                                 ContentPaths = new[] {rootPath}
                             };
            }
            else
            {
                result = new BrowseResult
                             {
                                 Files = files.Images(path),
                                 Directories = files.Folders(path),
                                 Path = VirtualPathUtility.AppendTrailingSlash(path),
                                 ContentPaths = new[] { VirtualPathUtility.AppendTrailingSlash(path) }
                             };
            }
            return Json(result);
        }
        public JsonResult Read(string path)
        {
            var files = new FilesRepository();

            var folders = files.Folders(path);

            var images = files.Images(path);

            return(Json(folders.Concat(images)));
        }
        public JsonResult Read(string path)
        {
            var files = new FilesRepository();

            var folders = files.Folders(path);

            var images = files.Images(path);

            return Json(folders.Concat(images));
        }