_20 Enero 2023

main
unknown 2 years ago
parent a5f24b26a9
commit de6dc2f451
  1. 23
      Controllers/DetallesController.cs
  2. 4
      Controllers/FacturaController.cs
  3. 10
      Models/Detalles.cs
  4. 42
      Repositorio/Repositoriooo.cs
  5. BIN
      bin/Debug/net6.0/MyFirstAPI.dll
  6. BIN
      bin/Debug/net6.0/MyFirstAPI.pdb
  7. BIN
      obj/Debug/net6.0/MyFirstAPI.dll
  8. BIN
      obj/Debug/net6.0/MyFirstAPI.pdb
  9. BIN
      obj/Debug/net6.0/ref/MyFirstAPI.dll
  10. BIN
      obj/Debug/net6.0/refint/MyFirstAPI.dll

@ -1,5 +1,6 @@
using System.ComponentModel; using System.ComponentModel;
using System.Security.Cryptography; using System.Security.Cryptography;
using Azure.Messaging;
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.Formatters;
@ -17,38 +18,24 @@ namespace MyFirstAPI.Controllers
private readonly Repositoriooo repositoriooo; private readonly Repositoriooo repositoriooo;
public DetallesController() public DetallesController()
{ {
repositoriooo = new Repositoriooo(); repositoriooo = new Repositoriooo();
} }
//GET PARA LEER LA TABLA DETALLES //GET PARA LEER LA TABLA DETALLES
[HttpGet] [HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult> Get() public async Task<ActionResult> Get()
{ {
var lista = await repositoriooo.GetDetalles(); var lista = await repositoriooo.GetDetalles();
return Ok(lista.ToList()); return Ok(lista.ToList());
} }
// ENVIAR DATOS EN LA TABLA DETALLES // ENVIAR DATOS EN LA TABLA DETALLES
[HttpPost] [HttpPost]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public async Task<IActionResult> Create(Detalles deta) public async Task<IActionResult> Create(Detalles deta)
{ {
await repositoriooo.Create(deta); await repositoriooo.Create(deta);
return Ok(); return Ok();
} }
// ACTUALIZAR DATOS EN LA TABLA DETALLES // ACTUALIZAR DATOS EN LA TABLA DETALLES
[HttpPut] [HttpPut]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
@ -59,19 +46,15 @@ namespace MyFirstAPI.Controllers
return Ok(); return Ok();
} }
// Elimar datos de la tabla detalles // Elimar datos de la tabla detalles
[HttpDelete] [HttpDelete]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> Delete( int id ) public async Task<IActionResult> Delete( int id )
{ {
await repositoriooo.Delete(id);
await repositoriooo.Delete(id );
return Ok(); return Ok();
} }
} }
} }

@ -9,7 +9,6 @@ namespace MyFirstAPI.Controllers
[Route("Api/Factura")] [Route("Api/Factura")]
public class FacturaController : ControllerBase public class FacturaController : ControllerBase
{ {
// crud para la tabla factura // crud para la tabla factura
private readonly Repositoriooo repositoriooo; private readonly Repositoriooo repositoriooo;
public FacturaController() public FacturaController()
@ -21,7 +20,6 @@ namespace MyFirstAPI.Controllers
/// get para leer la tabla factura /// get para leer la tabla factura
[HttpGet] [HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult> Getf() public async Task<ActionResult> Getf()
{ {
@ -43,6 +41,7 @@ namespace MyFirstAPI.Controllers
// ACTUALIZAR DATOS EN LA TABLA Factura // ACTUALIZAR DATOS EN LA TABLA Factura
[HttpPut] [HttpPut]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> Put(Factura fac) public async Task<IActionResult> Put(Factura fac)
{ {
@ -51,7 +50,6 @@ namespace MyFirstAPI.Controllers
} }
// Elimar datos de la tabla factura // Elimar datos de la tabla factura
[HttpDelete] [HttpDelete]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]

@ -16,16 +16,6 @@
//private string? _strNfactura; public string Nfactura { get => _strNfactura; set { _strNfactura = value; } }
//private string? _strArticuloNumber; public string ArticuloNumber { get { return _strArticuloNumber; } set { _strArticuloNumber = value; } }
//private int _intCantidad; public int Cantidad { get { return _intCantidad; } set { _dblPrecio = value; } }
//private double _dblPrecio; public double dblPrecio { get { return dblPrecio; } set { _dblPrecio = value; } }
//private double _dblTotalId; public double dblTotalId { get { return dblTotalId; } set { dblTotalId = value; } }
//private string _strArticulo; public string strArticulo { get { return _strArticulo; } set { _strArticulo = value; } }
//private byte _byteActivo; public byte Activo { get { return _byteActivo; } set { _byteActivo = value; } }
} }

@ -16,8 +16,7 @@ namespace MyFirstAPI.Repositorio
{ {
SqlConexion cn = new SqlConexion(); SqlConexion cn = new SqlConexion();
///Repositorio / #region "LEER TABLA DETALLES "
// dapper para leer detalles
public async Task<IEnumerable<Detalles>> GetDetalles() public async Task<IEnumerable<Detalles>> GetDetalles()
{ {
using (var connection = new SqlConnection(cn.CadenaSQL())) using (var connection = new SqlConnection(cn.CadenaSQL()))
@ -30,7 +29,9 @@ namespace MyFirstAPI.Repositorio
} }
} }
// dapper para leer factura #endregion
#region "LEER TABLA FACTURA"
public async Task<IEnumerable<Factura>> GetFactura() public async Task<IEnumerable<Factura>> GetFactura()
{ {
using (var connection = new SqlConnection(cn.CadenaSQL())) using (var connection = new SqlConnection(cn.CadenaSQL()))
@ -42,10 +43,14 @@ namespace MyFirstAPI.Repositorio
} }
} }
/// METODO POST PARA ENVIAR DATOS EN DETALLES #endregion
#region "METODO POST PARA ENVIAR DATOS EN LA TABLA DETALLES"
public async Task Create (Detalles deta) public async Task Create (Detalles deta)
{ {
//Detalles D = new Detalles();
var ProcedimientoalmacenadoInser = "SpInsert"; var ProcedimientoalmacenadoInser = "SpInsert";
using (var connection = new SqlConnection(cn.CadenaSQL())) using (var connection = new SqlConnection(cn.CadenaSQL()))
{ {
@ -58,12 +63,15 @@ namespace MyFirstAPI.Repositorio
Articulo = deta.Articulo, Articulo = deta.Articulo,
Cantidad = deta.Cantidad, Cantidad = deta.Cantidad,
Precio = deta.Precio Precio = deta.Precio
}, commandType: CommandType.StoredProcedure); },commandType: CommandType.StoredProcedure);
} }
} }
// METODO PARA ENVIAR FACTURA #endregion
#region "METODO POST PARA EBVIAR DATOS EN LA TABLA FACTURA"
public async Task CreateF(Factura fac) public async Task CreateF(Factura fac)
{ {
@ -84,10 +92,9 @@ namespace MyFirstAPI.Repositorio
}, commandType: CommandType.StoredProcedure); }, commandType: CommandType.StoredProcedure);
} }
} }
#endregion
#region"METODO PUT PARA ACTUALIZAR TABLA DETALLES"
//METODO PARA ACTUALIZAR DETALLES
public async Task UPDATED (Detalles deta) public async Task UPDATED (Detalles deta)
{ {
var ProcedimientoAlmacenadoUpdate = "SpUpdateDetalles"; var ProcedimientoAlmacenadoUpdate = "SpUpdateDetalles";
@ -107,10 +114,10 @@ namespace MyFirstAPI.Repositorio
} }
} }
#endregion
#region "METODO PUT PARA ACTUALIZAR LA TABLA FACTURA"
//Metodo Para Actualizar Factura
public async Task UpdateF (Factura fac) public async Task UpdateF (Factura fac)
{ {
var ProcedimientoAlmacendadoUpdateF = "SpUpdateFactura"; var ProcedimientoAlmacendadoUpdateF = "SpUpdateFactura";
@ -132,11 +139,9 @@ namespace MyFirstAPI.Repositorio
} }
} }
#endregion
#region "METODO DELETE PARA ELIMNAR DETALLES EN LA TABLA "
// METODO PARA ELIMINAR DETALLES
public async Task Delete (int id) public async Task Delete (int id)
{ {
@ -153,8 +158,9 @@ namespace MyFirstAPI.Repositorio
} }
} }
#endregion
// metodo para eliminar facturas #region"METODO PARA ELIMNAR FACTURA EN LA TABLA"
public async Task DeleteF (int Idff) public async Task DeleteF (int Idff)
{ {
var procedimientoAlmacenadoDeleteF = "SpEliminarFactura"; var procedimientoAlmacenadoDeleteF = "SpEliminarFactura";
@ -165,7 +171,7 @@ namespace MyFirstAPI.Repositorio
new { Idf = Idff }, commandType: CommandType.StoredProcedure); new { Idf = Idff }, commandType: CommandType.StoredProcedure);
} }
} }
#endregion
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save