Exemple #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"));
            }
        }
        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");

                try
                {
                    ISearchService _ss = new SearchServiceImp(_context, _config);
                    var            vm  = _ss.SearchFiles("", "", "", username);

                    ViewBag.totalRecords = vm.Count;
                    ViewBag.files        = vm;
                    return(View("index", vm));
                }
                catch (Exception e)
                {
                    return(View(Constants.ERROR_PATH));
                }
            }
            else
            {
                return(Redirect("~/Login"));
            }
        }
Exemple #3
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"));
            }
        }
        public ActionResult Search()
        {
            IUserService _us   = new UserServicesImpl(_context, _config);
            string       token = HttpContext.Session.GetString("token");

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

                try
                {
                    string fileName       = Request.Query[Constants.FILE_NAME];
                    string uploadDateFrom = Request.Query[Constants.UPLOAD_DATE_FROM];
                    string uploadDateTo   = Request.Query[Constants.UPLOAD_DATE_TO];


                    ViewBag.fileName       = !string.IsNullOrEmpty(fileName) ? fileName : null;
                    ViewBag.uploadDateFrom = !string.IsNullOrEmpty(uploadDateFrom) ? uploadDateFrom : null;
                    ViewBag.uploadDateTo   = !string.IsNullOrEmpty(uploadDateTo) ? uploadDateTo : null;


                    ISearchService _ss = new SearchServiceImp(_context, _config);
                    var            vm  = _ss.SearchFiles(fileName, uploadDateFrom, uploadDateTo, username);

                    ViewBag.totalRecords = vm.Count;
                    ViewBag.files        = vm;
                    return(View("index", vm));
                }
                catch (Exception e)
                {
                    return(View(Constants.ERROR_PATH));
                }
            }
            else
            {
                return(Redirect("~/Login"));
            }
        }