Example #1
0
        /// <summary>
        /// 移除菜单
        /// </summary>
        /// <param name="id">权限id</param>
        /// <param name="mids">菜单id集合</param>
        /// <returns></returns>
        public ActionResult RemoveMenus(int id, string mids)
        {
            string[]   ids        = mids.Split(',');
            Permission permission = PermissionBll.GetById(id);

            if (permission is null)
            {
                return(ResultData(null, false, "未找到相应的权限信息!"));
            }

            List <Menu> menus = MenuBll.LoadEntities(m => ids.Contains(m.Id.ToString())).ToList();

            menus.ForEach(m => permission.Menu.Remove(m));
            bool b = PermissionBll.UpdateEntitySaved(permission);

            return(ResultData(null, b, b ? "权限配置完成!" : "权限配置失败!"));
        }