parent
debd07084a
commit
39429d2f6d
@ -0,0 +1,11 @@ |
|||||||
|
using AOLBackend.DTO.Operaciones; |
||||||
|
|
||||||
|
namespace AOLBackend.Contracts.Operaciones |
||||||
|
{ |
||||||
|
public interface IOpViajesRepository |
||||||
|
{ |
||||||
|
public Task<DTOOpViajes> Append(DTOOpViajes data); |
||||||
|
public Task<IEnumerable<DTOOpViajes>> GetAll(); |
||||||
|
public Task<Boolean> Delete(int id); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
using AOLBackend.Contracts.Operaciones; |
||||||
|
using AOLBackend.DTO.Operaciones; |
||||||
|
using Microsoft.AspNetCore.Mvc; |
||||||
|
|
||||||
|
namespace AOLBackend.Controllers.Operaciones |
||||||
|
{ |
||||||
|
[ApiController] |
||||||
|
[Route("api/Operaciones/[controller]")]
|
||||||
|
public class OpViajesController : ControllerBase |
||||||
|
{ |
||||||
|
private readonly IOpViajesRepository _Repo; |
||||||
|
|
||||||
|
public OpViajesController(IOpViajesRepository Repo) |
||||||
|
{ |
||||||
|
_Repo = Repo; |
||||||
|
} |
||||||
|
|
||||||
|
[HttpPost] |
||||||
|
[Route("Append")] |
||||||
|
public async Task<DTOOpViajes> Append([FromBody] DTOOpViajes data) |
||||||
|
{ |
||||||
|
var entrada = await _Repo.Append(data); |
||||||
|
return entrada; |
||||||
|
} |
||||||
|
|
||||||
|
[HttpGet] |
||||||
|
[Route("Get")] |
||||||
|
public async Task<IEnumerable<DTOOpViajes>> GetAll() |
||||||
|
{ |
||||||
|
var entrada = await _Repo.GetAll(); |
||||||
|
return entrada; |
||||||
|
} |
||||||
|
|
||||||
|
[HttpDelete("Delete/{id}")] |
||||||
|
public async Task<IActionResult> Delete(int id) |
||||||
|
{ |
||||||
|
await _Repo.Delete(id); |
||||||
|
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
namespace AOLBackend.DTO.Operaciones |
||||||
|
{ |
||||||
|
public class DTOOpViajes |
||||||
|
{ |
||||||
|
public int id { get; set; } = 0; |
||||||
|
public string FAlta { get; set; } = null!; |
||||||
|
public int Usuario { get; set; } = 0; |
||||||
|
public string FCruce { get; set; } = null!; |
||||||
|
public string RefAgenciaAduanal { get; set; } = null!; |
||||||
|
public int Cliente { get; set; } = 0; |
||||||
|
public string? sCliente { get; set; } = null!; |
||||||
|
public int Proveedor { get; set; } = 0; |
||||||
|
public string? sProveedor { get; set; } = null!; |
||||||
|
public byte Hazmat { get; set; } = 0; |
||||||
|
public int Servicio { get; set; } = 0; |
||||||
|
public string? sServicio { get; set; } = null!; |
||||||
|
public byte TipoUnidad { get; set; } = 0; |
||||||
|
public string? sTipoUnidad { get; set; } = null!; |
||||||
|
public string NoCaja { get; set; } = null!; |
||||||
|
public string PickUpNumber { get; set; } = null!; |
||||||
|
public int Origen { get; set; } = 0; |
||||||
|
public string? sOrigen { get; set; } = null!; |
||||||
|
public int Destino { get; set; } = 0; |
||||||
|
public string? sDestino { get; set; } = null!; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
namespace AOLBackend.Models.Operaciones |
||||||
|
{ |
||||||
|
public class IOpViajes |
||||||
|
{ |
||||||
|
public int id { get; set; } = 0; |
||||||
|
public string FAlta { get; set; } = null!; |
||||||
|
public int Usuario { get; set; } = 0; |
||||||
|
public string FCruce { get; set; } = null!; |
||||||
|
public string RefAgenciaAduanal { get; set; } = null!; |
||||||
|
public int Cliente { get; set; } = 0; |
||||||
|
public int Proveedor { get; set; } = 0; |
||||||
|
public byte Hazmat { get; set; } = 0; |
||||||
|
public byte TipoUnidad { get; set; } = 0; |
||||||
|
public string NoCaja { get; set; } = null!; |
||||||
|
public string PickUpNumber { get; set; } = null!; |
||||||
|
public int Origen { get; set; } = 0; |
||||||
|
public int Destino { get; set; } = 0; |
||||||
|
public string FacturaProveedor { get; set; } = null!; |
||||||
|
public string FacturaAlphaOmega { get; set; } = null!; |
||||||
|
public string FPagoFactura { get; set; } = null!; |
||||||
|
public byte MetodoPago { get; set; } = 0; |
||||||
|
public string FPagoProveedor { get; set; } = null!; |
||||||
|
public int NoChequeAOL { get; set; } = 0; |
||||||
|
public int FacturarA { get; set; } = 0; |
||||||
|
public string FEntrega { get; set; } = null!; |
||||||
|
public int Status { get; set; } = 0; |
||||||
|
public int Activo { get; set; } = 0; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
using AOLBackend.Context; |
||||||
|
using AOLBackend.Contracts.Operaciones; |
||||||
|
using AOLBackend.DTO.Operaciones; |
||||||
|
using Dapper; |
||||||
|
using System.Data; |
||||||
|
|
||||||
|
namespace AOLBackend.Repository.Operaciones |
||||||
|
{ |
||||||
|
public class OpViajesRepository : IOpViajesRepository |
||||||
|
{ |
||||||
|
private readonly DapperContext _context; |
||||||
|
private readonly IConfiguration _config; |
||||||
|
public OpViajesRepository(DapperContext context, IConfiguration config) |
||||||
|
{ |
||||||
|
_context = context; |
||||||
|
_config = config; |
||||||
|
} |
||||||
|
|
||||||
|
public async Task<DTOOpViajes> Append(DTOOpViajes data) |
||||||
|
{ |
||||||
|
var query = "[Operaciones.Viajes.Append]"; |
||||||
|
using var connection = _context.CreateConnection(); |
||||||
|
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new |
||||||
|
{ |
||||||
|
@id = data.id, |
||||||
|
@Usuario = data.Usuario, |
||||||
|
@FCruce = data.FCruce, |
||||||
|
@RefAgenciaAduanal = data.RefAgenciaAduanal, |
||||||
|
@Cliente = data.Cliente, |
||||||
|
@Proveedor = data.Proveedor, |
||||||
|
@HazMat = data.Hazmat, |
||||||
|
@Servicio = data.Servicio, |
||||||
|
@TipoUnidad = data.TipoUnidad, |
||||||
|
@NoCaja = data.NoCaja, |
||||||
|
@PickUpNumber = data.PickUpNumber, |
||||||
|
@Origen = data.Origen, |
||||||
|
@Destino = data.Destino |
||||||
|
}, commandType: CommandType.StoredProcedure); |
||||||
|
return entrada.First(); |
||||||
|
} |
||||||
|
public async Task<IEnumerable<DTOOpViajes>> GetAll() |
||||||
|
{ |
||||||
|
var query = "[Operaciones.Viajes.Get]"; |
||||||
|
using var connection = _context.CreateConnection(); |
||||||
|
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new { }, commandType: CommandType.StoredProcedure); |
||||||
|
return entrada; |
||||||
|
} |
||||||
|
|
||||||
|
public async Task<Boolean> Delete(int id) |
||||||
|
{ |
||||||
|
var query = "[Operaciones.Viajes.Delete]"; |
||||||
|
using var connection = _context.CreateConnection(); |
||||||
|
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new { @id }, commandType: CommandType.StoredProcedure); |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@ |
|||||||
2042434c554652c90861df655d8b5f920355c627 |
ed603f94136a48ae0a4b114ef696f13d8ba5c20a |
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue