Refactor services to use repository pattern for database operations
- Updated EmpresaReportService to utilize ICatalogoRepository for stored procedure calls. - Refactored InformeService to include new method for executing Crystal Reports stored procedures. - Simplified LeadService by removing direct database connections and using ILeadRepository and ILeadQueryRepository. - Modified ReportService to leverage ICatalogoRepository for querying stored procedures. - Streamlined UsuarioService to use IUsuarioRepository for user authentication and profile retrieval. - Added new CatalogoService to handle various catalog-related queries and operations. - Introduced ArqueoRepository and CatalogoRepository for managing database interactions. - Created DTOs for various entities including Alumno, Contrato, Cotizacion, Descuento, Documento, Empresa, and Propuesta. - Implemented BaseController and ErrorController for standardized API responses and error handling. - Added QuestPDF package for PDF generation capabilities.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Ventas.Core.DTOs;
|
||||
using Ventas.Services;
|
||||
|
||||
namespace Ventas.API.Controllers;
|
||||
@@ -17,23 +18,23 @@ public class CotizacionController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Ingresar([FromQuery] string apoderadoId, [FromQuery] string vendedorId, [FromQuery] int descuento, [FromQuery] int tipoDescuento, [FromQuery] string fecha, [FromQuery] int monto, [FromQuery] string validez, [FromQuery] int leadId)
|
||||
public async Task<IActionResult> Ingresar([FromBody] CotizacionIngresoRequest request)
|
||||
{
|
||||
var result = await _cotizacionService.IngresarAsync(apoderadoId, vendedorId, descuento, tipoDescuento, fecha, monto, validez, leadId);
|
||||
var result = await _cotizacionService.IngresarAsync(request.ApoderadoId, request.VendedorId, request.SolicitudDescuento, request.Descuento, request.TipoDescuento, request.Fecha, request.Alumnos, request.Curso, request.Monto, request.Validez, request.LeadId);
|
||||
return Ok(new { id = result });
|
||||
}
|
||||
|
||||
[HttpPost("detalle")]
|
||||
public async Task<IActionResult> IngresarDetalle([FromQuery] int cotizacion, [FromQuery] string alumnoId, [FromQuery] int cursoId, [FromQuery] int cantidad, [FromQuery] int tarifa)
|
||||
public async Task<IActionResult> IngresarDetalle([FromBody] CotizacionDetalleRequest request)
|
||||
{
|
||||
var result = await _cotizacionService.IngresarDetalleAsync(cotizacion, alumnoId, cursoId, cantidad, tarifa);
|
||||
var result = await _cotizacionService.IngresarDetalleAsync(request.CotizacionId, request.AlumnoId, request.CursoId, request.Cantidad, request.Tarifa);
|
||||
return Ok(new { mensaje = result });
|
||||
}
|
||||
|
||||
[HttpPost("detalle-sin-curso")]
|
||||
public async Task<IActionResult> DetalleSinCurso([FromQuery] int cotizacion, [FromQuery] string alumnoId, [FromQuery] string apoderadoId, [FromQuery] int programaId, [FromQuery] int cantidad, [FromQuery] int tarifa, [FromQuery] int sedeId)
|
||||
public async Task<IActionResult> DetalleSinCurso([FromBody] CotizacionDetalleSinCursoRequest request)
|
||||
{
|
||||
var result = await _cotizacionService.DetalleSinCursoAsync(cotizacion, alumnoId, apoderadoId, programaId, cantidad, tarifa, sedeId);
|
||||
var result = await _cotizacionService.DetalleSinCursoAsync(request.CotizacionId, request.AlumnoId, request.ApoderadoId, request.ProgramaId, request.Cantidad, request.Tarifa, request.SedeId);
|
||||
return Ok(new { mensaje = result });
|
||||
}
|
||||
|
||||
@@ -89,21 +90,11 @@ public class CotizacionController : ControllerBase
|
||||
request.EstadoId, request.OticId, request.Motivo);
|
||||
return Ok(new { id = result });
|
||||
}
|
||||
}
|
||||
|
||||
public class CotizacionEmpRequest
|
||||
{
|
||||
public string EmpresaId { get; set; } = string.Empty;
|
||||
public string Vendedor { get; set; } = string.Empty;
|
||||
public int Alumnos { get; set; }
|
||||
public int Curso { get; set; }
|
||||
public int EmpresaMonto { get; set; }
|
||||
public int OticMonto { get; set; }
|
||||
public int AlumnoMonto { get; set; }
|
||||
public int CotizacionTipo { get; set; }
|
||||
public DateTime Validez { get; set; }
|
||||
public int DescuentoId { get; set; }
|
||||
public int EstadoId { get; set; }
|
||||
public string OticId { get; set; } = string.Empty;
|
||||
public string Motivo { get; set; } = string.Empty;
|
||||
[HttpPut("{id}/estado")]
|
||||
public async Task<IActionResult> ActualizarEstado(int id, [FromBody] CotizacionEstadoUpdateRequest request)
|
||||
{
|
||||
var result = await _cotizacionService.ActualizaEstadoCotizacionAsync(request.Tipo, id, request.ValorA ?? "", request.ValorB);
|
||||
return Ok(new { mensaje = result });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user