コード例 #1
0
        public IActionResult jayAdmin(string deleteThese)
        {
            #region login

            bool result = login.checkSession();
            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();
            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes" && curUser.username == "jamunro")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }


            #endregion


            VideoBackendViewModel videodata    = new VideoBackendViewModel();
            VideoBackEnd          videomethods = new VideoBackEnd();



            string[] tags = deleteThese.Split('|');

            foreach (var t in tags)
            {
                if (t != "")
                {
                    videomethods.deletetag(t);
                }
            }
            TempData["error"] = " Deleted " + deleteThese;

            videodata = videomethods.jayAllTags(videodata);
            return(View(videodata));
        }
コード例 #2
0
        public IActionResult addTag(string alltags, string delTags)
        {
            bool result = login.checkSession();

            if (result == false)
            {
                curPage.errorMsg  = "Either you do not have access to these tools or your session has timed out...";
                TempData["error"] = curUser.returnMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            AccountManager sqlStuff = new AccountManager();

            login userInformation = new login();

            curUser.username  = login.returnUsername();
            curUser.userTable = userdb;
            curUser           = AccountManager.checkAdmin(curUser);



            if (curUser.Admin != "Yes")
            {
                curPage.errorMsg = "An error has occured, please try again. ";
                //AccountManager curUser = new AccountManager();
                TempData["error"] = curPage.errorMsg;
                return(RedirectToAction("Index", "VideoBackend", curPage));
            }

            VideoBackendViewModel videoMetaData = new VideoBackendViewModel();
            VideoBackEnd          VBM           = new VideoBackEnd();


            if (delTags != "na")
            {
                string[] tags = delTags.Split('|');

                foreach (var t in tags)
                {
                    if (t != "")
                    {
                        VBM.deletetag(t);
                    }
                }
                TempData["error"] = "Deleted Tags";
                return(RedirectToAction("MainMenu", "VideoBackend", curPage));
            }


            if (alltags == "na")
            {
                TempData["error"] = "No tags entered...";
                return(RedirectToAction("MainMenu", "VideoBackend", curPage));
            }


            string[] tagArray;

            tagArray = VBM.parseTags(alltags);
            string x = VBM.processNewTags(tagArray);

            TempData["error"] = "Success";
            if (x != "Success")
            {
                TempData["error"] = "Unable to add. " + x;
            }

            return(RedirectToAction("MainMenu", "VideoBackend", curPage));
        }