Exemple #1
0
        public JsonFiles GetFileList()
        {
            var r = new List<ViewDataUploadFilesResult>();

            String fullPath = Path.Combine(StorageRoot);
            if (Directory.Exists(fullPath))
            {
                DirectoryInfo dir = new DirectoryInfo(fullPath);
                foreach (FileInfo file in dir.GetFiles())
                {
                    int SizeInt = unchecked((int)file.Length);
                    r.Add(UploadResult(file.Name, SizeInt, file.FullName));
                }

            }
            JsonFiles files = new JsonFiles(r);

            return files;
        }
        public JsonResult Upload()
        {
            var resultList = new List<ViewDataUploadFilesResult>();

                var CurrentContext = HttpContext;

                filesHelper.UploadAndShowResults(CurrentContext, resultList);
                JsonFiles files = new JsonFiles(resultList);

                bool isEmpty = !resultList.Any();
                if (isEmpty)
                {
                    return Json("Error ");
                }
                else
                {
                    return Json(files);
                }
        }