Initial commit

This commit is contained in:
arthur faria
2025-07-29 22:22:38 -03:00
commit 189fa1734c
22 changed files with 876 additions and 0 deletions

14
Data/IClientRepository.cs Normal file
View File

@@ -0,0 +1,14 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Workshop8.Models;
namespace Workshop8.Data
{
public interface IClientRepository
{
Task<IEnumerable<Cliente>> GetAllClientsAsync();
Task AddClientAsync(Cliente c);
Task UpdateClientAsync(Cliente c);
Task DeleteClientAsync(int id);
}
}

View File

@@ -0,0 +1,42 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Configuration;
using Workshop8.Models;
namespace Workshop8.Data
{
public class SqliteClientRepository : IClientRepository
{
private readonly string _connectionString;
public SqliteClientRepository(IConfiguration configuration)
{
var dbConfig = configuration.GetSection("Database");
_connectionString = dbConfig.GetValue<bool>("UseRemote")
? dbConfig.GetValue<string>("Remote")
: dbConfig.GetValue<string>("Local");
}
public async Task<IEnumerable<Cliente>> GetAllClientsAsync()
{
// TODO: implementar SELECT
return new List<Cliente>();
}
public async Task AddClientAsync(Cliente c)
{
// TODO: implementar INSERT
}
public async Task UpdateClientAsync(Cliente c)
{
// TODO: implementar UPDATE
}
public async Task DeleteClientAsync(int id)
{
// TODO: implementar DELETE
}
}
}