diff --git a/Controllers/DetallesController.cs b/Controllers/DetallesController.cs index bfcacac..7797757 100644 --- a/Controllers/DetallesController.cs +++ b/Controllers/DetallesController.cs @@ -1,10 +1,11 @@ using System.ComponentModel; using System.Security.Cryptography; +using System.Text.RegularExpressions; using Azure.Messaging; using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Formatters; -using MyFirstAPI.DATA; + using MyFirstAPI.Models; using MyFirstAPI.Repositorio; @@ -33,6 +34,12 @@ namespace MyFirstAPI.Controllers [ProducesResponseType(StatusCodes.Status200OK)] public async Task Create(Detalles deta) { + string pattern = "^[0-9]+$"; + bool result = Regex.IsMatch(deta.ArticuloNumber, pattern); + if (!result) + { + return BadRequest( "El articulo number debe ser solo numerico"); + } await repositoriooo.Create(deta); return Ok(); } diff --git a/DATA/Ddetalles.cs b/DATA/Ddetalles.cs deleted file mode 100644 index 3a14331..0000000 --- a/DATA/Ddetalles.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Data; -using Microsoft.Data.SqlClient; -using MyFirstAPI.Models; -using MyFirstAPI.Repositorio; - -namespace MyFirstAPI.DATA - -{ - public class Ddetalles - { - //ConexionDb cn = new ConexionDb(); - //public async Task> MostrarDetalles() - //{ - // var lista = new List(); - // using (var sql = new SqlConnection(cn.CadenaSql())) - // { - // using (var cmd = new SqlCommand("SpVerDetalles", sql)) - // { - // await sql.OpenAsync(); - // cmd.CommandType = CommandType.StoredProcedure; - // using (var iteam = await cmd.ExecuteReaderAsync()) - // { - // while (await iteam.ReadAsync()) - // { - // var detalles = new Detalles(); - // detalles.Id = (int)iteam["Id"]; - // detalles.IdFactura = (int)iteam["IdFactura"]; - // detalles.Nfactura = (string)iteam["Nfactura"]; - // detalles.ArticuloNumber = (string)iteam["ArticuloNumber"]; - // detalles.Cantidad = (int)iteam["Cantidad"]; - // detalles.Precio = (double)iteam["Precio"]; - // detalles.TotalId = (double)iteam["TotalId"]; - // detalles.Articulo = (string)iteam["Articulo"]; - // detalles.Activo = (byte)iteam["Activo"]; - // lista.Add(detalles); - - // } - - - // } - // } - - // } - // return lista; - - //} - - - - } -} diff --git a/Models/Factura.cs b/Models/Factura.cs index 9a066a9..2e005c3 100644 --- a/Models/Factura.cs +++ b/Models/Factura.cs @@ -3,85 +3,7 @@ public class Factura { #region"Atributos y propiedades factura " - //private int _intIdf; - - //public int Idf - //{ - // get { return _intIdf; } - // set { _intIdf = value; } - //} - - //private DateTime _dtmFecha; - - //public DateTime Fecha - - //{ - // get { return _dtmFecha; } - // set { _dtmFecha = value; } - //} - - - - //private string _strNumeroFactura; - - //public string NumeroFactura - //{ - // get { return _strNumeroFactura; } - // set { _strNumeroFactura = value; } - //} - - //private string _strMetodopago; - - //public string Metodopago - //{ - // get { return _strMetodopago; } - // set { _strMetodopago = value; } - //} - - - //private string _strDirrecion; - - //public string Dirrrecion - //{ - // get { return _strDirrecion; } - // set { _strDirrecion = value; } - //} - - - //private string _strEmpresa; - - //public string Empresa - //{ - // get { return _strEmpresa; } - // set { _strEmpresa = value; } - //} - - - //private double _dblSubtotal; - - //public double Subtotal - //{ - // get { return _dblSubtotal; } - // set { _dblSubtotal = value; } - //} - - //private double _dblTotal; - - //public double Total - //{ - // get { return _dblTotal; } - // set { _dblTotal = value; } - //} - - - //private byte _byteActivo; - - //public byte Activo - //{ - // get { return _byteActivo; } - // set { _byteActivo = value; } - //} - + public int Idf { get; set; } diff --git a/bin/Debug/net6.0/MyFirstAPI.dll b/bin/Debug/net6.0/MyFirstAPI.dll index 0a5b810..8b8a7de 100644 Binary files a/bin/Debug/net6.0/MyFirstAPI.dll and b/bin/Debug/net6.0/MyFirstAPI.dll differ diff --git a/bin/Debug/net6.0/MyFirstAPI.pdb b/bin/Debug/net6.0/MyFirstAPI.pdb index 1b7451a..8173ecc 100644 Binary files a/bin/Debug/net6.0/MyFirstAPI.pdb and b/bin/Debug/net6.0/MyFirstAPI.pdb differ diff --git a/obj/Debug/net6.0/MyFirstAPI.csproj.CoreCompileInputs.cache b/obj/Debug/net6.0/MyFirstAPI.csproj.CoreCompileInputs.cache index df13908..c6b400a 100644 --- a/obj/Debug/net6.0/MyFirstAPI.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net6.0/MyFirstAPI.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -c6dfb80b0039b072decc8c171abd1e494c782a76 +3cd71d297dd42d64ae88a8338c464cd6d31d1b73 diff --git a/obj/Debug/net6.0/MyFirstAPI.dll b/obj/Debug/net6.0/MyFirstAPI.dll index 0a5b810..8b8a7de 100644 Binary files a/obj/Debug/net6.0/MyFirstAPI.dll and b/obj/Debug/net6.0/MyFirstAPI.dll differ diff --git a/obj/Debug/net6.0/MyFirstAPI.pdb b/obj/Debug/net6.0/MyFirstAPI.pdb index 1b7451a..8173ecc 100644 Binary files a/obj/Debug/net6.0/MyFirstAPI.pdb and b/obj/Debug/net6.0/MyFirstAPI.pdb differ diff --git a/obj/Debug/net6.0/ref/MyFirstAPI.dll b/obj/Debug/net6.0/ref/MyFirstAPI.dll index ffd842d..8523374 100644 Binary files a/obj/Debug/net6.0/ref/MyFirstAPI.dll and b/obj/Debug/net6.0/ref/MyFirstAPI.dll differ diff --git a/obj/Debug/net6.0/refint/MyFirstAPI.dll b/obj/Debug/net6.0/refint/MyFirstAPI.dll index ffd842d..8523374 100644 Binary files a/obj/Debug/net6.0/refint/MyFirstAPI.dll and b/obj/Debug/net6.0/refint/MyFirstAPI.dll differ