Пример #1
0
        public void SaveFunctionsForRole(int roleId, string funcIds)
        {
            var role = _roleDal.GetRole(roleId);

            if (role == null)
            {
                throw new UserFriendlyException("查询不到Role");
            }

            _roleDal.DeleteRoleFunctions(roleId);

            if (!string.IsNullOrWhiteSpace(funcIds))
            {
                var funcIdList = funcIds.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                _roleDal.AddRoleFunctions(roleId, funcIdList.Select(p => int.Parse(p)));
            }
        }