public async Task AddLoginAsync(ApplicationUser user, UserLoginInfo login, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var createUserLoginDto = new CreateUserLoginDto { LoginProvider = login.LoginProvider, ProviderKey = login.ProviderKey, ProviderDisplayName = login.ProviderDisplayName, UserId = user.Id }; await _userLoginRepository.Create(createUserLoginDto); }
public async Task <UserLoginDto> Create(CreateUserLoginDto createUserLoginDto) { const string query = @" INSERT INTO [UserLogins] ([LoginProvider], [ProviderKey], [ProviderDisplayName], [UserId]) VALUES (@LoginProvider, @ProviderKey, @ProviderDisplayName, @UserId); "; using (var connection = _dbConnectionFactory.GetDbConnection()) { var insertedRowsNum = await connection.ExecuteAsync(query, createUserLoginDto); if (insertedRowsNum == 0) { return(null); } var userLoginDto = _mapper.Map <UserLoginDto>(createUserLoginDto); return(userLoginDto); } }