1 Commits

Author SHA1 Message Date
e0ca716162 teste 2025-07-30 18:15:43 +00:00
2 changed files with 7 additions and 27 deletions

View File

@@ -20,37 +20,18 @@ namespace Workshop8.Data
public async Task<IEnumerable<Cliente>> GetAllClientsAsync()
{
var clientes = new List<Cliente>();
// TODO: implementar SELECT
return new List<Cliente>();
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)
{
// TODO: implementar INSERT
//teste
}
public async Task UpdateClientAsync(Cliente c)

View File

@@ -3,9 +3,8 @@
@{
ViewData["Title"] = "Clientes";
}
<div class="d-flex justify-content-between align-items-center my-3">
<h3>Clientes</h3>
<h2>Clientes</h2>
<button class="btn btn-primary" type="button" id="createClientBtn">Adicionar Cliente</button>
</div>
<table class="table table-striped">