Beispiel #1
0
        public ActionResult Index()
        {
            IUserService _us   = new UserServicesImpl(_context, _config);
            string       token = HttpContext.Session.GetString("token");

            if (_us.ValidateCurrentToken(token))
            {
                string username = _us.GetClaim(token, "userId");

                ISearchService _ss = new SearchServiceImp(_context, _config);
                ViewBag.files = _ss.GetFiles(username, null);

                ILogService _ls = new LogServicesImp(_context, _config);
                ViewBag.logs = _ls.getLog(username);

                IFolderService _fs = new FolderServicesImp(_context, _config);
                ViewBag.folders = _fs.GetAllFoldersByUserId(username);

                return(View());
            }
            else
            {
                return(Redirect("~/Login"));
            }
        }
Beispiel #2
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            IUserService _us      = new UserServicesImpl(_context, _config);
            string       token    = HttpContext.Session.GetString("token");
            string       folderId = Request.Query["id"];

            if (_us.ValidateCurrentToken(token))
            {
                string username = _us.GetClaim(token, "userId");

                ISearchService _ss = new SearchServiceImp(_context, _config);
                ViewBag.files = _ss.GetFiles(username, folderId, 0);

                IFolderService _fs    = new FolderServicesImp(_context, _config);
                Folder         folder = _fs.GetFolderById(folderId);
                ViewBag.FolderName = folder.FolderName;
                ViewBag.FolderId   = folder.GUID;

                return(View());
            }
            else
            {
                return(Redirect("~/Login"));
            }
        }
Beispiel #3
0
        public IActionResult CreateFolder()
        {
            IUserService _us   = new UserServicesImpl(_context, _config);
            string       token = HttpContext.Session.GetString("token");
            string       name  = Request.Query["name"];

            if (_us.ValidateCurrentToken(token))
            {
                string username = _us.GetClaim(token, "userId");

                IFolderService _fs = new FolderServicesImp(_context, _config);

                return(Json(new { success = _fs.CreateFolder(name, username) }));
            }
            else
            {
                return(Redirect("~/Login"));
            }
        }