diff --git a/Data/SqliteClientRepository.cs b/Data/SqliteClientRepository.cs index 2aab76a..6cd12b3 100644 --- a/Data/SqliteClientRepository.cs +++ b/Data/SqliteClientRepository.cs @@ -20,8 +20,32 @@ namespace Workshop8.Data public async Task> GetAllClientsAsync() { - // TODO: implementar SELECT - return new List(); + var clientes = new List(); + + await using (var connection = new SqliteConnection(_connectionString)) + { + await connection.OpenAsync(); + await using (var cmd = connection.CreateCommand()) + { + cmd.CommandText = @"SELECT Id, Nome, Email, CriadoEm + FROM Clientes + ORDER BY Id;"; + await using (var reader = await cmd.ExecuteReaderAsync()) + { + while (await reader.ReadAsync()) + { + clientes.Add(new Cliente + { + Id = reader.GetInt32(0), + Nome = reader.GetString(1), + Email = reader.GetString(2), + CriadoEm = reader.GetDateTime(3) + }); + } + } + } + } + return clientes; } public async Task AddClientAsync(Cliente c)