feat: remaining services and controllers
- ContratoService + ContratoController (CRUD, PDF data, empresa, firma) - CotizacionService + CotizacionController (CRUD, detalle, pago, empresa) - AlumnoService + AlumnoController (CRUD, apoderado, consultas, colegios) - InformeService + InformeController (reportes ventas, leads, documentos) - All services registered in DI (Program.cs)
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Ventas.Services;
|
||||
|
||||
namespace Ventas.API.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class CotizacionController : ControllerBase
|
||||
{
|
||||
private readonly CotizacionService _cotizacionService;
|
||||
|
||||
public CotizacionController(CotizacionService cotizacionService)
|
||||
{
|
||||
_cotizacionService = cotizacionService;
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
var result = await _cotizacionService.IngresarAsync(apoderadoId, vendedorId, descuento, tipoDescuento, fecha, monto, validez, 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)
|
||||
{
|
||||
var result = await _cotizacionService.IngresarDetalleAsync(cotizacion, alumnoId, cursoId, cantidad, 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)
|
||||
{
|
||||
var result = await _cotizacionService.DetalleSinCursoAsync(cotizacion, alumnoId, apoderadoId, programaId, cantidad, tarifa, sedeId);
|
||||
return Ok(new { mensaje = result });
|
||||
}
|
||||
|
||||
[HttpGet("lead/{lead}")]
|
||||
public async Task<IActionResult> BuscarPorLead(int lead)
|
||||
{
|
||||
var result = await _cotizacionService.BuscarAsync(lead);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet("lead/{lead}/sin-curso")]
|
||||
public async Task<IActionResult> BuscarSinCurso(int lead)
|
||||
{
|
||||
var result = await _cotizacionService.BuscarSinCursoAsync(lead);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet("buscar")]
|
||||
public async Task<IActionResult> BuscarInfo([FromQuery] string tipoBusqueda, [FromQuery] string nombre)
|
||||
{
|
||||
var result = await _cotizacionService.BuscarInfoAsync(tipoBusqueda, nombre);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet("{id}/detalle")]
|
||||
public async Task<IActionResult> Detalle(int id)
|
||||
{
|
||||
var result = await _cotizacionService.DetalleAsync(id);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/pagar")]
|
||||
public async Task<IActionResult> Pagar(int id)
|
||||
{
|
||||
var result = await _cotizacionService.PersonaPagarAsync(id);
|
||||
return Ok(new { mensaje = result });
|
||||
}
|
||||
|
||||
[HttpPut("{id}/desactivar")]
|
||||
public async Task<IActionResult> Desactivar(int id)
|
||||
{
|
||||
var result = await _cotizacionService.DesactivarAsync(id);
|
||||
return Ok(new { mensaje = result });
|
||||
}
|
||||
|
||||
[HttpPost("empresa")]
|
||||
public async Task<IActionResult> CotizacionEmpIngreso([FromBody] CotizacionEmpRequest request)
|
||||
{
|
||||
var result = await _cotizacionService.CotizacionEmpIngresoAsync(
|
||||
request.EmpresaId, request.Vendedor, request.Alumnos, request.Curso,
|
||||
request.EmpresaMonto, request.OticMonto, request.AlumnoMonto,
|
||||
request.CotizacionTipo, request.Validez, request.DescuentoId,
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user