public async Task Create(TwoFactorAuthenticationSession twoFactorAuthenticationSession) { using (var connection = new SqlConnection(_identityOptions.ConnectionString)) using (var command = new SqlCommand(_insertSql, connection)) { command.Parameters.AddWithValue("@Created", twoFactorAuthenticationSession.Created); command.Parameters.AddWithNullableValue("@Deleted", twoFactorAuthenticationSession.Deleted); command.Parameters.AddWithValue("@IdentityId", twoFactorAuthenticationSession.IdentityId); command.Parameters.AddWithValue("@KeyCode", twoFactorAuthenticationSession.KeyCode); command.Parameters.AddWithValue("@SessionId", twoFactorAuthenticationSession.SessionId); command.Parameters.AddWithValue("@Type", twoFactorAuthenticationSession.Type); command.Parameters.AddWithValue("@Updated", twoFactorAuthenticationSession.Updated); await connection.OpenAsync(); twoFactorAuthenticationSession.Id = (int)await command.ExecuteScalarAsync(); } }
public Task Delete(TwoFactorAuthenticationSession twoFactorAuthenticationSession) { twoFactorAuthenticationSession.Deleted = DateTimeOffset.Now; return(Update(twoFactorAuthenticationSession)); }