Beispiel #1
0
        /// <summary>
        /// 将指定的用户赋予指定的角色。
        /// </summary>
        /// <param name="userID">需要赋予角色的用户ID值。</param>
        /// <param name="roleID">需要向用户赋予的角色ID值。</param>
        public void AssignRole(Guid userID, Guid roleID)
        {
            var user = userRepository.GetByKey(userID);
            var role = roleRepository.GetByKey(roleID);

            domainService.AssignRole(user, role);
        }
        public void AssignRole(Guid userId, Guid roleId)
        {
            var user = _userRepository.GetByKey(userId);
            var role = _roleRepository.GetByKey(roleId);

            _domainService.AssignRole(user, role);
        }