public ActionResult GetDocumnets(string Id)
        {
            var user = UserManager.Users.SingleOrDefault(u => u.Id == Id);

            if (user != null)
            {
                UserDocumentsViewModel model = new UserDocumentsViewModel();
                model.Documents = new Dictionary <string, string>();
                var res = FSservice.GetAllFilesName(FileType.PDF, Id);
                if (res.Success)
                {
                    // Get only pdf files
                    model.Documents = res.Entities.Where(d => d.Contains(".pdf")).Select((p) => new {
                        key   = p,
                        value = p
                    })
                                      .ToDictionary(k => k.key, v => v.value);
                }

                model.User = user;
                // Save url to geet back to after action ends
                ViewBag.ReturnURL = Request.UrlReferrer;
                return(View(model));
            }

            throw new HttpException(404, "משתמש לא נמצא");
        }
Beispiel #2
0
        public ActionResult UserDocuments(string currentFolderGuid = "")
        {
            var userId = User.Identity.GetUserId();

            if (string.IsNullOrEmpty(userId))
            {
                RedirectToAction("Index", "Home");
            }

            var model = new UserDocumentsViewModel()
            {
                CurrentFolderGuid = currentFolderGuid
            };

            if (!string.IsNullOrEmpty(currentFolderGuid))
            {
                var parentFolder = _userFileService.GetByGuid(currentFolderGuid);
                model.ParentFolderGuid = parentFolder.ParentFile?.FileGuid;
            }

            if (string.IsNullOrEmpty(currentFolderGuid))
            {
                model.Files = GetUserRootFiles(userId);
            }
            else
            {
                model.Files = GetUserFolderGuidFiles(currentFolderGuid);
            }

            return(View(model));
        }