Beispiel #1
0
        public ActionResult BatchDele(long[] selectRoleIDs)
        {
            long?userId = LoginHelper.GetUserId(HttpContext); //获取当前登录的用户,他不能自己删除自己

            if (selectRoleIDs.Contains(userId.Value))
            {
                return(Json(new AjaxResult()
                {
                    Status = "warn"
                }));
            }
            if (selectRoleIDs != null)
            {
                for (int i = 0; i < selectRoleIDs.Length; i++)
                {
                    AdminUserService.DeleteAdmin(selectRoleIDs[i]);
                }

                return(Json(new AjaxResult()
                {
                    Status = "ok"
                }));
            }
            else
            {
                return(Json(new AjaxResult()
                {
                    Status = "no"
                }));
            }
        }
Beispiel #2
0
        public ActionResult DeleAdmin(long id)
        {
            long?userId = LoginHelper.GetUserId(HttpContext); //获取session

            if (id == userId.Value)
            {
                return(Json(new AjaxResult()
                {
                    Status = "warn"
                }));
            }
            bool b = AdminUserService.DeleteAdmin(id);

            if (b)
            {
                return(Json(new AjaxResult()
                {
                    Status = "ok"
                }));
            }
            else
            {
                return(Json(new AjaxResult()
                {
                    Status = "no"
                }));
            }
        }