diff --git a/.vs/AOLBackend/DesignTimeBuild/.dtbcache.v2 b/.vs/AOLBackend/DesignTimeBuild/.dtbcache.v2 index aebb0b7..07b7abf 100644 Binary files a/.vs/AOLBackend/DesignTimeBuild/.dtbcache.v2 and b/.vs/AOLBackend/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/AOLBackend/FileContentIndex/3d7623a8-da92-4a1a-b860-08edca7a2da7.vsidx b/.vs/AOLBackend/FileContentIndex/3d7623a8-da92-4a1a-b860-08edca7a2da7.vsidx deleted file mode 100644 index 1054251..0000000 Binary files a/.vs/AOLBackend/FileContentIndex/3d7623a8-da92-4a1a-b860-08edca7a2da7.vsidx and /dev/null differ diff --git a/.vs/AOLBackend/v17/.futdcache.v1 b/.vs/AOLBackend/v17/.futdcache.v1 index af6705c..e0fa6ec 100644 Binary files a/.vs/AOLBackend/v17/.futdcache.v1 and b/.vs/AOLBackend/v17/.futdcache.v1 differ diff --git a/.vs/AOLBackend/v17/.suo b/.vs/AOLBackend/v17/.suo index c7cdc67..e525611 100644 Binary files a/.vs/AOLBackend/v17/.suo and b/.vs/AOLBackend/v17/.suo differ diff --git a/.vs/ProjectEvaluation/aolbackend.metadata.v2 b/.vs/ProjectEvaluation/aolbackend.metadata.v2 index 3cbd18f..6b4e676 100644 Binary files a/.vs/ProjectEvaluation/aolbackend.metadata.v2 and b/.vs/ProjectEvaluation/aolbackend.metadata.v2 differ diff --git a/.vs/ProjectEvaluation/aolbackend.projects.v2 b/.vs/ProjectEvaluation/aolbackend.projects.v2 index 218ede1..cd1e929 100644 Binary files a/.vs/ProjectEvaluation/aolbackend.projects.v2 and b/.vs/ProjectEvaluation/aolbackend.projects.v2 differ diff --git a/Contracts/Catalogos/ICatProveedoresRepository.cs b/Contracts/Catalogos/ICatProveedoresRepository.cs new file mode 100644 index 0000000..d8ab53d --- /dev/null +++ b/Contracts/Catalogos/ICatProveedoresRepository.cs @@ -0,0 +1,12 @@ +using AOLBackend.Models.Catalogos; + +namespace AOLBackend.Contracts.Catalogos +{ + public interface ICatProveedoresRepository + { + public Task Append(ICatProveedores data); + public Task> GetAll(); + public Task Delete(int id); + + } +} \ No newline at end of file diff --git a/Contracts/Catalogos/ICatTipoUnidadRepository.cs b/Contracts/Catalogos/ICatTipoUnidadRepository.cs new file mode 100644 index 0000000..b012a2c --- /dev/null +++ b/Contracts/Catalogos/ICatTipoUnidadRepository.cs @@ -0,0 +1,11 @@ +using AOLBackend.Models.Catalogos; + +namespace AOLBackend.Contracts.Catalogos +{ + public interface ICatTipoUnidadRepository + { + public Task Append(ICatTipoUnidad data); + public Task> GetAll(); + public Task Delete(int id); + } +} \ No newline at end of file diff --git a/Contracts/Catalogos/ICatUbicacionesRepository.cs b/Contracts/Catalogos/ICatUbicacionesRepository.cs new file mode 100644 index 0000000..6749bec --- /dev/null +++ b/Contracts/Catalogos/ICatUbicacionesRepository.cs @@ -0,0 +1,11 @@ +using AOLBackend.Models.Catalogos; + +namespace AOLBackend.Contracts.Catalogos +{ + public interface ICatUbicacionesRepository + { + public Task Append(ICatUbicaciones data); + public Task> GetAll(); + public Task Delete(int id); + } +} \ No newline at end of file diff --git a/Controllers/Catalogos/CatClientesController.cs b/Controllers/Catalogos/CatClientesController.cs index a30dce3..6f7c40d 100644 --- a/Controllers/Catalogos/CatClientesController.cs +++ b/Controllers/Catalogos/CatClientesController.cs @@ -1,6 +1,4 @@ using AOLBackend.Contracts.Catalogos; -using AOLBackend.DTO; -using AOLBackend.DTO.Usuario; using AOLBackend.Models.Catalogos; using Microsoft.AspNetCore.Mvc; diff --git a/Controllers/Catalogos/CatProveedoresController.cs b/Controllers/Catalogos/CatProveedoresController.cs new file mode 100644 index 0000000..ce17f6f --- /dev/null +++ b/Controllers/Catalogos/CatProveedoresController.cs @@ -0,0 +1,41 @@ +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Microsoft.AspNetCore.Mvc; + +namespace AOLBackend.Controllers.Catalogos +{ + [ApiController] + [Route("api/Catalogos/[controller]")] + public class CatProveedoresController : ControllerBase + { + private readonly ICatProveedoresRepository _Repo; + + public CatProveedoresController(ICatProveedoresRepository Repo) + { + _Repo = Repo; + } + + [HttpPost] + [Route("Append")] + public async Task Append([FromBody] ICatProveedores 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/CatTipoUnidadController.cs b/Controllers/Catalogos/CatTipoUnidadController.cs new file mode 100644 index 0000000..57c505a --- /dev/null +++ b/Controllers/Catalogos/CatTipoUnidadController.cs @@ -0,0 +1,40 @@ +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Microsoft.AspNetCore.Mvc; + +namespace AOLBackend.Controllers.Catalogos +{ + [ApiController] + [Route("api/Catalogos/[controller]")] + public class CatTipoUnidadController : ControllerBase + { + private readonly ICatTipoUnidadRepository _Repo; + public CatTipoUnidadController(ICatTipoUnidadRepository Repo) + { + _Repo = Repo; + } + + [HttpPost] + [Route("Append")] + public async Task Append([FromBody] ICatTipoUnidad 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/CatUbicacionesController.cs b/Controllers/Catalogos/CatUbicacionesController.cs new file mode 100644 index 0000000..02df040 --- /dev/null +++ b/Controllers/Catalogos/CatUbicacionesController.cs @@ -0,0 +1,41 @@ +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Microsoft.AspNetCore.Mvc; + + +namespace AOLBackend.Controllers.Catalogos +{ + [ApiController] + [Route("api/Catalogos/[controller]")] + public class CatUbicacionesController : ControllerBase + { + private readonly ICatUbicacionesRepository _Repo; + public CatUbicacionesController(ICatUbicacionesRepository Repo) + { + _Repo = Repo; + } + + [HttpPost] + [Route("Append")] + public async Task Append([FromBody] ICatUbicaciones 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/Models/Catalogos/ICatProveedores.cs b/Models/Catalogos/ICatProveedores.cs index 9dab571..e3fbff0 100644 --- a/Models/Catalogos/ICatProveedores.cs +++ b/Models/Catalogos/ICatProveedores.cs @@ -2,7 +2,7 @@ namespace AOLBackend.Models.Catalogos { public class ICatProveedores { - public int Id { get; set; } + public int id { get; set; } public string Proveedor { get; set; } = null!; public Byte Activo { get; set; } = 0!; } diff --git a/Models/Catalogos/ICatTipoUnidad.cs b/Models/Catalogos/ICatTipoUnidad.cs new file mode 100644 index 0000000..63ade35 --- /dev/null +++ b/Models/Catalogos/ICatTipoUnidad.cs @@ -0,0 +1,9 @@ +namespace AOLBackend.Models.Catalogos +{ + public class ICatTipoUnidad + { + public int id { get; set; } = 0!; + public string TipoUnidad { get; set; } = null!; + public Byte Activo { get; set; } = 0!; + } +} \ No newline at end of file diff --git a/Models/Catalogos/IOrigenDestino.cs b/Models/Catalogos/ICatUbicaciones.cs similarity index 69% rename from Models/Catalogos/IOrigenDestino.cs rename to Models/Catalogos/ICatUbicaciones.cs index fd6b3ed..03f8c07 100644 --- a/Models/Catalogos/IOrigenDestino.cs +++ b/Models/Catalogos/ICatUbicaciones.cs @@ -1,8 +1,8 @@ namespace AOLBackend.Models.Catalogos { - public class IOrigenDestino + public class ICatUbicaciones { - public int Id { get; set; } + public int id { get; set; } public string Ubicacion { get; set; } = null!; public Byte Activo { get; set; } = 0!; } diff --git a/Models/IUsuarios.cs b/Models/IUsuarios.cs index c9aa7db..61cf899 100644 --- a/Models/IUsuarios.cs +++ b/Models/IUsuarios.cs @@ -2,7 +2,7 @@ { public class IUsuarios { - public int Id { get; set; } = 0; + public int Id { get; set; } = 0!; public string Usuario { get; set; } = null!; public string Nombre { get; set; } = null!; public string Contrasena { get; set; } = null!; diff --git a/Program.cs b/Program.cs index 8c4ebea..7bd40b8 100644 --- a/Program.cs +++ b/Program.cs @@ -10,7 +10,13 @@ using System.Text; var builder = WebApplication.CreateBuilder(args); builder.Services.AddSingleton(); builder.Services.AddScoped(); +builder.Services.AddScoped(); + +// Catalogos 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/CatClientesRepository.cs b/Repository/Catalogos/CatClientesRepository.cs index d990f83..d338039 100644 --- a/Repository/Catalogos/CatClientesRepository.cs +++ b/Repository/Catalogos/CatClientesRepository.cs @@ -1,9 +1,6 @@ using AOLBackend.Context; using AOLBackend.Contracts.Catalogos; -using AOLBackend.DTO; -using AOLBackend.DTO.Usuario; using AOLBackend.Models.Catalogos; -using AOLBackend.Services.Tools; using Dapper; using System.Data; diff --git a/Repository/Catalogos/CatProveedoresRepository.cs b/Repository/Catalogos/CatProveedoresRepository.cs new file mode 100644 index 0000000..3ce6c22 --- /dev/null +++ b/Repository/Catalogos/CatProveedoresRepository.cs @@ -0,0 +1,46 @@ +using AOLBackend.Context; +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Dapper; +using System.Data; + +namespace AOLBackend.Repository.Catalogos +{ + public class CatProveedoresRepository : ICatProveedoresRepository + { + private readonly DapperContext _context; + private readonly IConfiguration _config; + public CatProveedoresRepository(DapperContext context, IConfiguration config) + { + _context = context; + _config = config; + } + + public async Task Append(ICatProveedores data) + { + var query = "[Catalogo.CatProveedores.Append]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @id = data.id, + @Proveedor = data.Proveedor, + }, commandType: CommandType.StoredProcedure); + return entrada.First(); + } + public async Task> GetAll() + { + var query = "[Catalogo.CatProveedores.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.CatProveedores.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/CatTipoUnidadRepository.cs b/Repository/Catalogos/CatTipoUnidadRepository.cs new file mode 100644 index 0000000..abdc83a --- /dev/null +++ b/Repository/Catalogos/CatTipoUnidadRepository.cs @@ -0,0 +1,46 @@ +using AOLBackend.Context; +using AOLBackend.Contracts.Catalogos; +using AOLBackend.Models.Catalogos; +using Dapper; +using System.Data; + +namespace AOLBackend.Repository.Catalogos +{ + public class CatTipoUnidadRepository : ICatTipoUnidadRepository + { + private readonly DapperContext _context; + private readonly IConfiguration _config; + public CatTipoUnidadRepository(DapperContext context, IConfiguration config) + { + _context = context; + _config = config; + } + + public async Task Append(ICatTipoUnidad data) + { + var query = "[Catalogo.CatTipoUnidad.Append]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @id = data.id, + @TipoUnidad = data.TipoUnidad, + }, commandType: CommandType.StoredProcedure); + return entrada.First(); + } + public async Task> GetAll() + { + var query = "[Catalogo.CatTipoUnidad.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.CatTipoUnidad.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 new file mode 100644 index 0000000..f775e0c --- /dev/null +++ b/Repository/Catalogos/CatUbicacionesRepository.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 CatUbicacionesRepository : ICatUbicacionesRepository + { + private readonly DapperContext _context; + private readonly IConfiguration _config; + public CatUbicacionesRepository(DapperContext context, IConfiguration config) + { + _context = context; + _config = config; + } + + public async Task Append(ICatUbicaciones data) + { + var query = "[Catalogo.CatUbicaciones.Append]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @id = data.id, + @Ubicacion = data.Ubicacion, + }, commandType: CommandType.StoredProcedure); + return entrada.First(); + } + public async Task> GetAll() + { + var query = "[Catalogo.CatUbicaciones.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.CatUbicaciones.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/bin/Debug/net6.0/AOLBackend.dll b/bin/Debug/net6.0/AOLBackend.dll index 56a481f..2668c33 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 891cafe..3891754 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.csproj.CoreCompileInputs.cache b/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache index edf33b7..bb006ab 100644 --- a/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -5c4d83d23e299243135bbd3e0f354dc85d91df62 +4d7d0b7fb49ca16452b034f5986c30e9a38fc20a diff --git a/obj/Debug/net6.0/AOLBackend.dll b/obj/Debug/net6.0/AOLBackend.dll index 56a481f..2668c33 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 891cafe..3891754 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 0036f27..0979fa8 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 0036f27..0979fa8 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 a891214..34269d5 100644 --- a/obj/staticwebassets.pack.sentinel +++ b/obj/staticwebassets.pack.sentinel @@ -36,3 +36,26 @@ 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 +2.0 +2.0 +2.0 +2.0 +2.0