public IHttpActionResult Get(string name, int pageSize, int pageNumber, string orderBy)
        {
            var path = new
            {
                Name = name
            };
            Dyrectory dyr = new Dyrectory(name + "://");

            var totalCount = dyr.Elements.Count();
            var totalPages = Math.Ceiling((double)totalCount / pageSize);

            var fileQuery = dyr.Elements;

            if (QueryHelper.PropertyExists <Elem>(orderBy))
            {
                var orderByExpression = QueryHelper.GetPropertyExpression <Elem>(orderBy);
                fileQuery = fileQuery.OrderBy(orderByExpression);
            }
            else
            {
                fileQuery = fileQuery.OrderBy(c => c.Type);
            }

            var elements = fileQuery.Skip((pageNumber - 1) * pageSize)
                           .Take(pageSize)
                           .ToList();

            var result = new
            {
                Path       = path,
                TotalCount = totalCount,
                TotalPages = totalPages,
                Elements   = elements
            };

            return(Ok(result));
        }
        public IHttpActionResult Get(string name, int pageSize, int pageNumber, string orderBy, string folderPath)
        {
            string parentFolder = "", urlPath = "", localPath = "";

            if (folderPath.Contains("-!"))
            {
                urlPath      = folderPath.Replace("-!", "/");
                localPath    = folderPath.Replace("-!", "\\");
                parentFolder = folderPath.Substring(0, folderPath.LastIndexOf("-!"));
            }
            else
            {
                urlPath = localPath = folderPath;
            }

            var path = new
            {
                Name         = name,
                FolderPath   = folderPath,
                UrlPath      = urlPath,
                LocalPath    = localPath,
                ParentFolder = parentFolder
            };
            Dyrectory dyr = new Dyrectory(name + "://" + urlPath);

            var firstCount  = dyr.CountFiles(-1, 10000000);
            var secondCount = dyr.CountFiles(10000000, 50000000);
            var thirdCount  = dyr.CountFiles(100000000, -1);

            var countFiles = new
            {
                FirstCount  = firstCount,
                SecondCount = secondCount,
                ThirdCount  = thirdCount
            };
            var totalCount = dyr.Elements.Count();
            var totalPages = Math.Ceiling((double)totalCount / pageSize);

            var fileQuery = dyr.Elements;

            if (QueryHelper.PropertyExists <Elem>(orderBy))
            {
                var orderByExpression = QueryHelper.GetPropertyExpression <Elem>(orderBy);
                fileQuery = fileQuery.OrderBy(orderByExpression);
            }
            else
            {
                fileQuery = fileQuery.OrderBy(c => c.Type);
            }

            var elements = fileQuery.Skip((pageNumber - 1) * pageSize)
                           .Take(pageSize)
                           .ToList();

            var result = new
            {
                Path       = path,
                TotalCount = totalCount,
                TotalPages = totalPages,
                Elements   = elements,
                countFiles = countFiles
            };

            return(Ok(result));
        }