Exemplo n.º 1
0
        public IActionResult RemoveAdmin(string username)
        {
            if (HttpContext.Session.GetString("AdminID") != null)
            {
                if (username == HttpContext.Session.GetString("AdminID"))
                {
                    return(RedirectToAction("AdminWarning"));
                }
                else
                {
                    UserMethod um = new UserMethod();
                    um.DeleteAdmin(username, out string errormsg);

                    ViewData["error"] = errormsg;
                    return(RedirectToAction("AllUsers"));
                }
            }
            else
            {
                return(RedirectToAction("AdminLogin"));
            }
        }