public ActionResult Index(Models.FolderModel model) { if (model.folderPath != null) { return(View(model)); } Session["fPath"] = folderModel.folderPath = Server.MapPath(@"~\wwroot\"); return(View(folderModel)); }
/// <summary> /// Метод Storage возвращает страницу каталога с идентификатором id /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Storage(int id) { //получаем информацию о текущем каталоге и о его родителях Models.FolderModel folder = new Models.FolderModel() { CurrentFolder = Logic.GetFileById(id), RootID = Logic.GetParentId(id), }; if (folder.CurrentFolder.Extension != "folder") { return(Redirect("~/Account/Storage?id=" + folder.RootID)); } //формируем списки подкатологов и содержащихся файлов List <Models.FileModel> subfolders = new List <Models.FileModel>(); List <Models.FileModel> files = new List <Models.FileModel>(); foreach (FileEntity f in Logic.GetSubfolders(id)) { subfolders.Add(new Models.FileModel(f)); } foreach (FileEntity f in Logic.GetFiles(id)) { files.Add(new Models.FileModel(f)); } //выставляем доступы к файлам for (int i = 0; i < files.Count; i++) { files[i].AccessedUsers = new List <User>(Logic.GetAllowedUsers(files[i].ID)); files[i].HasAccess = files[i].Access == AccessType.Public || files[i].Access == AccessType.Private && files[i].OwnerName.Equals(User.Identity.Name) || files[i].Access == AccessType.Limited && ContainUser(files[i].AccessedUsers, User.Identity.Name); } folder.SubFolders = subfolders; folder.Files = files; //проверяем наличие доступа к текущему каталогу folder.HasAccess = folder.CurrentFolder.Access == AccessType.Public || folder.CurrentFolder.Access == AccessType.Private && folder.CurrentFolder.Owner.Name.Equals(User.Identity.Name) || folder.CurrentFolder.Access == AccessType.Limited && ContainUser(Logic.GetAllowedUsers(id), User.Identity.Name); return(View(folder)); }
/// <summary> /// Метод Storage возвращает страницу каталога с идентификатором id /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Storage(int id) { //получаем информацию о текущем каталоге и о его родителях Models.FolderModel folder = new Models.FolderModel() { CurrentFolder = Logic.GetFileById(id), RootID = Logic.GetParentId(id), }; if (folder.CurrentFolder.Extension != "folder") return Redirect("~/Account/Storage?id="+folder.RootID); //формируем списки подкатологов и содержащихся файлов List<Models.FileModel> subfolders = new List<Models.FileModel>(); List<Models.FileModel> files = new List<Models.FileModel>(); foreach(FileEntity f in Logic.GetSubfolders(id)) subfolders.Add(new Models.FileModel(f)); foreach (FileEntity f in Logic.GetFiles(id)) files.Add(new Models.FileModel(f)); //выставляем доступы к файлам for (int i = 0; i < files.Count; i++) { files[i].AccessedUsers = new List<User>(Logic.GetAllowedUsers(files[i].ID)); files[i].HasAccess = files[i].Access == AccessType.Public || files[i].Access == AccessType.Private && files[i].OwnerName.Equals(User.Identity.Name) || files[i].Access == AccessType.Limited && ContainUser(files[i].AccessedUsers, User.Identity.Name); } folder.SubFolders = subfolders; folder.Files = files; //проверяем наличие доступа к текущему каталогу folder.HasAccess = folder.CurrentFolder.Access == AccessType.Public || folder.CurrentFolder.Access == AccessType.Private && folder.CurrentFolder.Owner.Name.Equals(User.Identity.Name) || folder.CurrentFolder.Access == AccessType.Limited && ContainUser(Logic.GetAllowedUsers(id), User.Identity.Name); return View(folder); }
public ActionResult Index(Models.FileModel model, Models.FolderModel fmodel) { //services = new Models.RepoManagerServices(); if (fmodel.folderName != null) { Thread t1 = new Thread(() => { Directory.CreateDirectory(Session["fPath"].ToString() + @"\" + fmodel.folderName); }); t1.Start(); } //var path = Server.MapPath("~/wwroot/"); if (model.file != null || model.filePath != null) { Thread t = new Thread(() => { services.UploadFile(model.file, Session["fPath"].ToString()); }); t.Start(); } folderModel.folderPath = Session["fPath"].ToString(); return(View(folderModel)); }
public ActionResult EnterDir(Models.FolderModel fObject) { Session["fPath"] = folderModel.folderPath = fObject.folderPath; return(RedirectToAction("Index", folderModel)); }