partido + melhorias
This commit is contained in:
@@ -58,6 +58,17 @@ namespace OpenCand.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Partido?> GetPartidoBySigla(string sigla)
|
||||
{
|
||||
using (var connection = new NpgsqlConnection(ConnectionString))
|
||||
{
|
||||
var query = @"
|
||||
SELECT * FROM partido
|
||||
WHERE sigla = @sigla";
|
||||
return await connection.QueryFirstOrDefaultAsync<Partido>(query, new { sigla });
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<RedeSocial>?> GetCandidatoRedeSocialById(Guid idcandidato)
|
||||
{
|
||||
using (var connection = new NpgsqlConnection(ConnectionString))
|
||||
|
@@ -21,7 +21,7 @@ namespace OpenCand.API.Repository
|
||||
(SELECT COUNT(*) FROM bem_candidato) AS TotalBemCandidatos,
|
||||
(SELECT SUM(valor) FROM bem_candidato) AS TotalValorBemCandidatos,
|
||||
(SELECT COUNT(*) FROM rede_social) AS TotalRedesSociais,
|
||||
(SELECT COUNT(DISTINCT ano) FROM bem_candidato) AS TotalEleicoes;");
|
||||
(SELECT COUNT(DISTINCT ano) FROM candidato_mapping) AS TotalEleicoes;");
|
||||
return stats ?? new OpenCandStats();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user