Se agrega catalogo de rutas

develop
Al Garcia 2 years ago
parent 616956b19b
commit debd07084a
  1. 12
      Contracts/Catalogos/ICatRutasRepository.cs
  2. 11
      Contracts/Catalogos/ICatServiciosRepository.cs
  3. 42
      Controllers/Catalogos/CatRutasController.cs
  4. 42
      Controllers/Catalogos/CatServiciosController.cs
  5. 24
      DTO/Catalogos/DTOCatRutas.cs
  6. 18
      Models/Catalogos/ICatRutas.cs
  7. 11
      Models/Catalogos/ICatServicios.cs
  8. 1
      Models/Catalogos/ICatUbicaciones.cs
  9. 2
      Program.cs
  10. 55
      Repository/Catalogos/CatRutasRepository.cs
  11. 47
      Repository/Catalogos/CatServiciosRepository.cs
  12. 1
      Repository/Catalogos/CatUbicacionesRepository.cs
  13. BIN
      bin/Debug/net6.0/AOLBackend.dll
  14. BIN
      bin/Debug/net6.0/AOLBackend.pdb
  15. 4
      obj/Debug/net6.0/AOLBackend.GeneratedMSBuildEditorConfig.editorconfig
  16. BIN
      obj/Debug/net6.0/AOLBackend.assets.cache
  17. 2
      obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache
  18. BIN
      obj/Debug/net6.0/AOLBackend.dll
  19. BIN
      obj/Debug/net6.0/AOLBackend.pdb
  20. BIN
      obj/Debug/net6.0/ref/AOLBackend.dll
  21. BIN
      obj/Debug/net6.0/refint/AOLBackend.dll
  22. 18
      obj/staticwebassets.pack.sentinel

@ -0,0 +1,12 @@
using AOLBackend.Models.Catalogos;
using AOLBackend.DTO.Catalogos;
namespace AOLBackend.Contracts.Catalogos
{
public interface ICatRutasRepository
{
public Task<ICatRutas> Append(ICatRutas data);
public Task<IEnumerable<DTOCatRutas>> GetAll();
public Task<Boolean> Delete(int id);
}
}

@ -0,0 +1,11 @@
using AOLBackend.Models.Catalogos;
namespace AOLBackend.Contracts.Catalogos
{
public interface ICatServiciosRepository
{
public Task<ICatServicios> Append(ICatServicios data);
public Task<IEnumerable<ICatServicios>> GetAll();
public Task<Boolean> Delete(int id);
}
}

@ -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<ICatRutas> Append([FromBody] ICatRutas data)
{
var entrada = await _Repo.Append(data);
return entrada;
}
[HttpGet]
[Route("Get")]
public async Task<IEnumerable<DTOCatRutas>> 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,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<ICatServicios> Append([FromBody] ICatServicios data)
{
var entrada = await _Repo.Append(data);
return entrada;
}
[HttpGet]
[Route("Get")]
public async Task<IEnumerable<ICatServicios>> 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,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!;
}
}

@ -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!;
}
}

@ -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!;
}
}

@ -4,6 +4,7 @@ namespace AOLBackend.Models.Catalogos
{ {
public int id { get; set; } public int id { get; set; }
public string Ubicacion { get; set; } = null!; public string Ubicacion { get; set; } = null!;
public Byte Clasificacion { get; set; } = 0!;
public Byte Activo { get; set; } = 0!; public Byte Activo { get; set; } = 0!;
} }
} }

@ -17,6 +17,8 @@ builder.Services.AddScoped<ICatClientesRepository, CatClientesRepository>();
builder.Services.AddScoped<ICatProveedoresRepository, CatProveedoresRepository>(); builder.Services.AddScoped<ICatProveedoresRepository, CatProveedoresRepository>();
builder.Services.AddScoped<ICatUbicacionesRepository, CatUbicacionesRepository>(); builder.Services.AddScoped<ICatUbicacionesRepository, CatUbicacionesRepository>();
builder.Services.AddScoped<ICatTipoUnidadRepository, CatTipoUnidadRepository>(); builder.Services.AddScoped<ICatTipoUnidadRepository, CatTipoUnidadRepository>();
builder.Services.AddScoped<ICatServiciosRepository, CatServiciosRepository>();
builder.Services.AddScoped<ICatRutasRepository, CatRutasRepository>();
builder.Services.AddControllers(); builder.Services.AddControllers();
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>

@ -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<ICatRutas> Append(ICatRutas data)
{
var query = "[Catalogo.CatRutas.Append]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatRutas>(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<IEnumerable<DTOCatRutas>> GetAll()
{
var query = "[Catalogo.CatRutas.Get]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<DTOCatRutas>(query, new { }, commandType: CommandType.StoredProcedure);
return entrada;
}
public async Task<Boolean> Delete(int id)
{
var query = "[Catalogo.CatRutas.Delete]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatRutas>(query, new { @id }, commandType: CommandType.StoredProcedure);
return true;
}
}
}

@ -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<ICatServicios> Append(ICatServicios data)
{
var query = "[Catalogo.CatServicios.Append]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatServicios>(query, new
{
@id = data.id,
@Servicios = data.Servicio,
@Precio = data.Precio,
}, commandType: CommandType.StoredProcedure);
return entrada.First();
}
public async Task<IEnumerable<ICatServicios>> GetAll()
{
var query = "[Catalogo.CatServicios.Get]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatServicios>(query, new { }, commandType: CommandType.StoredProcedure);
return entrada;
}
public async Task<Boolean> Delete(int id)
{
var query = "[Catalogo.CatServicios.Delete]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatServicios>(query, new { @id }, commandType: CommandType.StoredProcedure);
return true;
}
}
}

@ -24,6 +24,7 @@ namespace AOLBackend.Repository.Catalogos
{ {
@id = data.id, @id = data.id,
@Ubicacion = data.Ubicacion, @Ubicacion = data.Ubicacion,
@Clasificacion = data.Clasificacion
}, commandType: CommandType.StoredProcedure); }, commandType: CommandType.StoredProcedure);
return entrada.First(); return entrada.First();
} }

Binary file not shown.

Binary file not shown.

@ -8,9 +8,9 @@ build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = AOLBackend build_property.RootNamespace = AOLBackend
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.RazorLangVersion = 6.0
build_property.SupportLocalizedComponentNames = build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes = build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\projects\staging\AOLBackend build_property.MSBuildProjectDirectory = c:\projects\staging\AOLBackend
build_property._RazorSourceGeneratorDebug = build_property._RazorSourceGeneratorDebug =

@ -1 +1 @@
4d7d0b7fb49ca16452b034f5986c30e9a38fc20a 2042434c554652c90861df655d8b5f920355c627

Binary file not shown.

Binary file not shown.

@ -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
2.0
2.0
2.0

Loading…
Cancel
Save