コード例 #1
0
        public async Task UnlinkUser(UnlinkUserInput input)
        {
            var currentUserAccount = await _userLinkManager.GetUserAccountAsync(AbpSession.ToUserIdentifier());

            if (!currentUserAccount.UserLinkId.HasValue)
            {
                throw new Exception(L("You are not linked to any account"));
            }

            if (!await _userLinkManager.AreUsersLinked(AbpSession.ToUserIdentifier(), input.ToUserIdentifier()))
            {
                return;
            }

            await _userLinkManager.Unlink(input.ToUserIdentifier());
        }
コード例 #2
0
        public async Task UnlinkUser(UnlinkUserInput input)
        {
            var currentUserId = AbpSession.GetUserId();
            var currentUser   = await UserManager.GetUserByIdAsync(currentUserId);

            if (!currentUser.UserLinkId.HasValue)
            {
                throw new ApplicationException(L("You are not linked to any account"));
            }

            using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
            {
                if (!await _userLinkManager.AreUsersLinked(currentUserId, input.UserId))
                {
                    return;
                }

                await _userLinkManager.Unlink(input.UserId);
            }
        }