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