feat: complete fase 1 - all controllers, services, middleware
- Added Ejecutivo.cs entity - ArqueoService + ArqueoController (arqueos por fecha/usuario) - 13 missing controllers: Curso, Descuento, Documento, Empresa, Horario, Jornada, Programa, Propuesta, Region, Sala, Sede, Tarifa, Usuario - JwtMiddleware.cs for cookie/token validation - SpComplexQueries.cs for Dapper multi-resultset - ArqueoService registered in DI - Build: 0 errors - Total: 21 controllers, 8 services, 7 repos, 21 entities
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Dapper;
|
||||
using Npgsql;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Ventas.API.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class TarifaController : ControllerBase
|
||||
{
|
||||
private readonly string _connectionString;
|
||||
|
||||
public TarifaController(IConfiguration configuration) => _connectionString = configuration.GetConnectionString("Default")!;
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Buscar([FromQuery] int producto, [FromQuery] int programa, [FromQuery] int jornada, [FromQuery] int sede, [FromQuery] string fecha)
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString);
|
||||
var rows = await connection.QueryAsync("sige_sam_v3.BuscarTarifa",
|
||||
new { producto, programa, jornada, sede, fecha },
|
||||
commandType: System.Data.CommandType.StoredProcedure);
|
||||
return Ok(rows.Select(r => (Dictionary<string, object>)(IDictionary<string, object>)r!));
|
||||
}
|
||||
|
||||
[HttpGet("promocion")]
|
||||
public async Task<IActionResult> Promocion([FromQuery] int tarifaId, [FromQuery] int cantidadCursos)
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString);
|
||||
var rows = await connection.QueryAsync("sige_sam_v3.BuscarTarifaPromocion",
|
||||
new { tarifa = tarifaId, cantcursos = cantidadCursos },
|
||||
commandType: System.Data.CommandType.StoredProcedure);
|
||||
return Ok(rows.Select(r => (Dictionary<string, object>)(IDictionary<string, object>)r!));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user