1 Commits

Author SHA1 Message Date
db37684595 Update Data/SqliteClientRepository.cs 2025-07-30 18:46:00 +00:00

View File

@@ -20,29 +20,28 @@ namespace Workshop8.Data
public async Task<IEnumerable<Cliente>> GetAllClientsAsync()
{
// SELECT
var clientes = new List<Cliente>();
await using var conn = new SqliteConnection(_connectionString);
var clientes = new List<Cliente>();
// TODO: implementar SELECT
await using var conn = new SqliteConnection("Data Source=database.sqlite;");
await conn.OpenAsync();
var cmd = conn.CreateCommand();
cmd.CommandText = "SELECT id, nome, email, CriadoEm FROM Clientes;";
cmd.CommandText = "SELECT Nome, Email, CriadoEm FROM Clientes;";
await using var reader = await cmd.ExecuteReaderAsync();
while (await reader.ReadAsync())
{
var c = new Cliente
var p = new Cliente
{
Id = reader.GetInt32(0),
Nome = reader.GetString(1),
Email = reader.GetString(2),
CriadoEm = reader.GetDateTime(3)
Email = reader.GetString(1),
CriadoEm = reader.GetDateTime(2)
};
clientes.Add(c);
clientes.Add(p);
}
return clientes;
return new List<Cliente>();
}
public async Task AddClientAsync(Cliente c)