diff --git a/Contracts/Catalogos/ICatRutasRepository.cs b/Contracts/Catalogos/ICatRutasRepository.cs new file mode 100644 index 0000000..31ac76c --- /dev/null +++ b/Contracts/Catalogos/ICatRutasRepository.cs @@ -0,0 +1,12 @@ +using AOLBackend.Models.Catalogos; +using AOLBackend.DTO.Catalogos; + +namespace AOLBackend.Contracts.Catalogos +{ + public interface ICatRutasRepository + { + public Task Append(ICatRutas data); + public Task> GetAll(); + public Task Delete(int id); + } +} \ No newline at end of file diff --git a/Contracts/Catalogos/ICatServiciosRepository.cs b/Contracts/Catalogos/ICatServiciosRepository.cs new file mode 100644 index 0000000..78f7805 --- /dev/null +++ b/Contracts/Catalogos/ICatServiciosRepository.cs @@ -0,0 +1,11 @@ +using AOLBackend.Models.Catalogos; + +namespace AOLBackend.Contracts.Catalogos +{ + public interface ICatServiciosRepository + { + public Task Append(ICatServicios data); + public Task> GetAll(); + public Task Delete(int id); + } +} \ No newline at end of file diff --git a/Controllers/Catalogos/CatRutasController.cs b/Controllers/Catalogos/CatRutasController.cs new file mode 100644 index 0000000..ccfa214 --- /dev/null +++ b/Controllers/Catalogos/CatRutasController.cs @@ -0,0 +1,42 @@ +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using AOLBackend.DTO.Catalogos; +using Microsoft.AspNetCore.Mvc; + +namespace AOLBackend.Controllers.Catalogos +{ + [ApiController] + [Route("api/Catalogos/[controller]")] + public class CatRutasController : ControllerBase + { + private readonly ICatRutasRepository _Repo; + + public CatRutasController(ICatRutasRepository Repo) + { + _Repo = Repo; + } + + [HttpPost] + [Route("Append")] + public async Task Append([FromBody] ICatRutas data) + { + var entrada = await _Repo.Append(data); + return entrada; + } + + [HttpGet] + [Route("Get")] + public async Task> GetAll() + { + var entrada = await _Repo.GetAll(); + return entrada; + } + + [HttpDelete("Delete/{id}")] + public async Task Delete(int id) + { + await _Repo.Delete(id); + return new OkObjectResult(new { respuesta = "Se elimino el registro" }); + } + } +} \ No newline at end of file diff --git a/Controllers/Catalogos/CatServiciosController.cs b/Controllers/Catalogos/CatServiciosController.cs new file mode 100644 index 0000000..22c658d --- /dev/null +++ b/Controllers/Catalogos/CatServiciosController.cs @@ -0,0 +1,42 @@ +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Microsoft.AspNetCore.Mvc; + + +namespace AOLBackend.Controllers.Catalogos +{ + [ApiController] + [Route("api/Catalogos/[controller]")] + public class CatServiciosController : ControllerBase + { + private readonly ICatServiciosRepository _Repo; + + public CatServiciosController(ICatServiciosRepository Repo) + { + _Repo = Repo; + } + + [HttpPost] + [Route("Append")] + public async Task Append([FromBody] ICatServicios data) + { + var entrada = await _Repo.Append(data); + return entrada; + } + + [HttpGet] + [Route("Get")] + public async Task> GetAll() + { + var entrada = await _Repo.GetAll(); + return entrada; + } + + [HttpDelete("Delete/{id}")] + public async Task Delete(int id) + { + await _Repo.Delete(id); + return new OkObjectResult(new { respuesta = "Se elimino el registro" }); + } + } +} \ No newline at end of file diff --git a/DTO/Catalogos/DTOCatRutas.cs b/DTO/Catalogos/DTOCatRutas.cs new file mode 100644 index 0000000..8533953 --- /dev/null +++ b/DTO/Catalogos/DTOCatRutas.cs @@ -0,0 +1,24 @@ +namespace AOLBackend.DTO.Catalogos +{ + public class DTOCatRutas + { + public int id { get; set; } + public int Cliente { get; set; } = 0; + public string sCliente { get; set; } = null!; + public int Servicio { get; set; } = 0; + public string sServicio { get; set; } = null!; + public double Precio { get; set; } = 0; + public int Proveedor { get; set; } = 0; + public string sProveedor { get; set; } = null!; + public double Costo { get; set; } = 0; + public int Origen { get; set; } = 0; + public string sOrigen { get; set; } = null!; + public int Destino { get; set; } = 0; + public string sDestino { get; set; } = null!; + public int TipoUnidad { get; set; } = 0; + public string sTipoUnidad { get; set; } = null!; + public string FCreacion { get; set; } = null!; + public string FActualizacion { get; set; } = null!; + public Byte Activo { get; set; } = 0!; + } +} \ No newline at end of file diff --git a/Models/Catalogos/ICatRutas.cs b/Models/Catalogos/ICatRutas.cs new file mode 100644 index 0000000..182b430 --- /dev/null +++ b/Models/Catalogos/ICatRutas.cs @@ -0,0 +1,18 @@ +namespace AOLBackend.Models.Catalogos +{ + public class ICatRutas + { + public int id { get; set; } + public int Cliente { get; set; } = 0; + public int Servicio { get; set; } = 0; + public double Precio { get; set; } = 0; + public int Proveedor { get; set; } = 0; + public double Costo { get; set; } = 0; + public int Origen { get; set; } = 0; + public int Destino { get; set; } = 0; + public int TipoUnidad { get; set; } = 0; + public string? FCreacion { get; set; } = null!; + public string? FActualizacion { get; set; } = null!; + public Byte Activo { get; set; } = 0!; + } +} \ No newline at end of file diff --git a/Models/Catalogos/ICatServicios.cs b/Models/Catalogos/ICatServicios.cs new file mode 100644 index 0000000..a238d82 --- /dev/null +++ b/Models/Catalogos/ICatServicios.cs @@ -0,0 +1,11 @@ + +namespace AOLBackend.Models.Catalogos +{ + public class ICatServicios + { + public int id { get; set; } + public string Servicio { get; set; } = null!; + public decimal Precio { get; set; } = 0; + public Byte Activo { get; set; } = 0!; + } +} \ No newline at end of file diff --git a/Models/Catalogos/ICatUbicaciones.cs b/Models/Catalogos/ICatUbicaciones.cs index 03f8c07..87afc19 100644 --- a/Models/Catalogos/ICatUbicaciones.cs +++ b/Models/Catalogos/ICatUbicaciones.cs @@ -4,6 +4,7 @@ namespace AOLBackend.Models.Catalogos { public int id { get; set; } public string Ubicacion { get; set; } = null!; + public Byte Clasificacion { get; set; } = 0!; public Byte Activo { get; set; } = 0!; } } \ No newline at end of file diff --git a/Program.cs b/Program.cs index 7bd40b8..6a2ee24 100644 --- a/Program.cs +++ b/Program.cs @@ -17,6 +17,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddControllers(); builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => diff --git a/Repository/Catalogos/CatRutasRepository.cs b/Repository/Catalogos/CatRutasRepository.cs new file mode 100644 index 0000000..e6aa6d1 --- /dev/null +++ b/Repository/Catalogos/CatRutasRepository.cs @@ -0,0 +1,55 @@ +using AOLBackend.Context; +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using AOLBackend.DTO.Catalogos; +using Dapper; +using System.Data; + +namespace AOLBackend.Repository.Catalogos +{ + public class CatRutasRepository : ICatRutasRepository + { + private readonly DapperContext _context; + private readonly IConfiguration _config; + public CatRutasRepository(DapperContext context, IConfiguration config) + { + _context = context; + _config = config; + } + + public async Task Append(ICatRutas data) + { + var query = "[Catalogo.CatRutas.Append]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @id = data.id, + @Cliente = data.Cliente, + @Servicio = data.Servicio, + @Precio = data.Precio, + @Proveedor = data.Proveedor, + @Costo = data.Costo, + @Origen = data.Origen, + @Destino = data.Destino, + @TipoUnidad = data.TipoUnidad, + @Activo = data.Activo + }, commandType: CommandType.StoredProcedure); + return entrada.First(); + } + public async Task> GetAll() + { + var query = "[Catalogo.CatRutas.Get]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new { }, commandType: CommandType.StoredProcedure); + return entrada; + } + + public async Task Delete(int id) + { + var query = "[Catalogo.CatRutas.Delete]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new { @id }, commandType: CommandType.StoredProcedure); + return true; + } + } +} \ No newline at end of file diff --git a/Repository/Catalogos/CatServiciosRepository.cs b/Repository/Catalogos/CatServiciosRepository.cs new file mode 100644 index 0000000..87b6c99 --- /dev/null +++ b/Repository/Catalogos/CatServiciosRepository.cs @@ -0,0 +1,47 @@ +using AOLBackend.Context; +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Dapper; +using System.Data; + +namespace AOLBackend.Repository.Catalogos +{ + public class CatServiciosRepository : ICatServiciosRepository + { + private readonly DapperContext _context; + private readonly IConfiguration _config; + public CatServiciosRepository(DapperContext context, IConfiguration config) + { + _context = context; + _config = config; + } + + public async Task Append(ICatServicios data) + { + var query = "[Catalogo.CatServicios.Append]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @id = data.id, + @Servicios = data.Servicio, + @Precio = data.Precio, + }, commandType: CommandType.StoredProcedure); + return entrada.First(); + } + public async Task> GetAll() + { + var query = "[Catalogo.CatServicios.Get]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new { }, commandType: CommandType.StoredProcedure); + return entrada; + } + + public async Task Delete(int id) + { + var query = "[Catalogo.CatServicios.Delete]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new { @id }, commandType: CommandType.StoredProcedure); + return true; + } + } +} \ No newline at end of file diff --git a/Repository/Catalogos/CatUbicacionesRepository.cs b/Repository/Catalogos/CatUbicacionesRepository.cs index f775e0c..cffe7c9 100644 --- a/Repository/Catalogos/CatUbicacionesRepository.cs +++ b/Repository/Catalogos/CatUbicacionesRepository.cs @@ -24,6 +24,7 @@ namespace AOLBackend.Repository.Catalogos { @id = data.id, @Ubicacion = data.Ubicacion, + @Clasificacion = data.Clasificacion }, commandType: CommandType.StoredProcedure); return entrada.First(); } diff --git a/bin/Debug/net6.0/AOLBackend.dll b/bin/Debug/net6.0/AOLBackend.dll index 2668c33..f977019 100644 Binary files a/bin/Debug/net6.0/AOLBackend.dll and b/bin/Debug/net6.0/AOLBackend.dll differ diff --git a/bin/Debug/net6.0/AOLBackend.pdb b/bin/Debug/net6.0/AOLBackend.pdb index 3891754..ca6a2dd 100644 Binary files a/bin/Debug/net6.0/AOLBackend.pdb and b/bin/Debug/net6.0/AOLBackend.pdb differ diff --git a/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig index aa0a97e..fc61964 100644 --- a/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig +++ b/obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig @@ -8,9 +8,9 @@ build_property.PlatformNeutralAssembly = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = AOLBackend build_property.RootNamespace = AOLBackend -build_property.ProjectDir = C:\projects\staging\AOLBackend\ +build_property.ProjectDir = c:\projects\staging\AOLBackend\ build_property.RazorLangVersion = 6.0 build_property.SupportLocalizedComponentNames = build_property.GenerateRazorMetadataSourceChecksumAttributes = -build_property.MSBuildProjectDirectory = C:\projects\staging\AOLBackend +build_property.MSBuildProjectDirectory = c:\projects\staging\AOLBackend build_property._RazorSourceGeneratorDebug = diff --git a/obj/Debug/net6.0/AOLBackend.assets.cache b/obj/Debug/net6.0/AOLBackend.assets.cache index 20a4db6..1389778 100644 Binary files a/obj/Debug/net6.0/AOLBackend.assets.cache and b/obj/Debug/net6.0/AOLBackend.assets.cache differ diff --git a/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache b/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache index bb006ab..d2efcf1 100644 --- a/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -4d7d0b7fb49ca16452b034f5986c30e9a38fc20a +2042434c554652c90861df655d8b5f920355c627 diff --git a/obj/Debug/net6.0/AOLBackend.dll b/obj/Debug/net6.0/AOLBackend.dll index 2668c33..f977019 100644 Binary files a/obj/Debug/net6.0/AOLBackend.dll and b/obj/Debug/net6.0/AOLBackend.dll differ diff --git a/obj/Debug/net6.0/AOLBackend.pdb b/obj/Debug/net6.0/AOLBackend.pdb index 3891754..ca6a2dd 100644 Binary files a/obj/Debug/net6.0/AOLBackend.pdb and b/obj/Debug/net6.0/AOLBackend.pdb differ diff --git a/obj/Debug/net6.0/ref/AOLBackend.dll b/obj/Debug/net6.0/ref/AOLBackend.dll index 0979fa8..19d1441 100644 Binary files a/obj/Debug/net6.0/ref/AOLBackend.dll and b/obj/Debug/net6.0/ref/AOLBackend.dll differ diff --git a/obj/Debug/net6.0/refint/AOLBackend.dll b/obj/Debug/net6.0/refint/AOLBackend.dll index 0979fa8..19d1441 100644 Binary files a/obj/Debug/net6.0/refint/AOLBackend.dll and b/obj/Debug/net6.0/refint/AOLBackend.dll differ diff --git a/obj/staticwebassets.pack.sentinel b/obj/staticwebassets.pack.sentinel index 34269d5..72d7281 100644 --- a/obj/staticwebassets.pack.sentinel +++ b/obj/staticwebassets.pack.sentinel @@ -59,3 +59,21 @@ 2.0 2.0 2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0 +2.0