|
|
|
@ -15,9 +15,8 @@ namespace MyFirstAPI.Repositorio |
|
|
|
|
public class Repositoriooo : DateTimeConverter |
|
|
|
|
{ |
|
|
|
|
SqlConexion cn = new SqlConexion(); |
|
|
|
|
|
|
|
|
|
///Repositorio / |
|
|
|
|
// dapper para leer detalles |
|
|
|
|
|
|
|
|
|
#region "LEER TABLA DETALLES " |
|
|
|
|
public async Task<IEnumerable<Detalles>> GetDetalles() |
|
|
|
|
{ |
|
|
|
|
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() |
|
|
|
|
{ |
|
|
|
|
using (var connection = new SqlConnection(cn.CadenaSQL())) |
|
|
|
@ -42,28 +43,35 @@ 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) |
|
|
|
|
{ |
|
|
|
|
//Detalles D = new Detalles(); |
|
|
|
|
var ProcedimientoalmacenadoInser = "SpInsert"; |
|
|
|
|
using (var connection = new SqlConnection(cn.CadenaSQL())) |
|
|
|
|
{ |
|
|
|
|
var detalles = await connection.ExecuteAsync(ProcedimientoalmacenadoInser, |
|
|
|
|
new |
|
|
|
|
{ |
|
|
|
|
Idfactura = deta.IdFactura, |
|
|
|
|
Nfactura = deta.Nfactura, |
|
|
|
|
ArticuloNumber = deta.ArticuloNumber, |
|
|
|
|
Articulo = deta.Articulo, |
|
|
|
|
Cantidad = deta.Cantidad, |
|
|
|
|
Precio = deta.Precio |
|
|
|
|
}, commandType: CommandType.StoredProcedure); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ProcedimientoalmacenadoInser = "SpInsert"; |
|
|
|
|
using (var connection = new SqlConnection(cn.CadenaSQL())) |
|
|
|
|
{ |
|
|
|
|
var detalles = await connection.ExecuteAsync(ProcedimientoalmacenadoInser, |
|
|
|
|
new |
|
|
|
|
{ |
|
|
|
|
Idfactura = deta.IdFactura, |
|
|
|
|
Nfactura = deta.Nfactura, |
|
|
|
|
ArticuloNumber = deta.ArticuloNumber, |
|
|
|
|
Articulo = deta.Articulo, |
|
|
|
|
Cantidad = deta.Cantidad, |
|
|
|
|
Precio = deta.Precio |
|
|
|
|
},commandType: CommandType.StoredProcedure); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// METODO PARA ENVIAR FACTURA |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region "METODO POST PARA EBVIAR DATOS EN LA TABLA FACTURA" |
|
|
|
|
public async Task CreateF(Factura fac) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
@ -84,10 +92,9 @@ namespace MyFirstAPI.Repositorio |
|
|
|
|
}, commandType: CommandType.StoredProcedure); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//METODO PARA ACTUALIZAR DETALLES |
|
|
|
|
|
|
|
|
|
#region"METODO PUT PARA ACTUALIZAR TABLA DETALLES" |
|
|
|
|
public async Task UPDATED (Detalles deta) |
|
|
|
|
{ |
|
|
|
|
var ProcedimientoAlmacenadoUpdate = "SpUpdateDetalles"; |
|
|
|
@ -107,10 +114,10 @@ namespace MyFirstAPI.Repositorio |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Metodo Para Actualizar Factura |
|
|
|
|
#region "METODO PUT PARA ACTUALIZAR LA TABLA FACTURA" |
|
|
|
|
|
|
|
|
|
public async Task UpdateF (Factura fac) |
|
|
|
|
{ |
|
|
|
|
var ProcedimientoAlmacendadoUpdateF = "SpUpdateFactura"; |
|
|
|
@ -126,17 +133,15 @@ namespace MyFirstAPI.Repositorio |
|
|
|
|
Empresa = fac.Empresa, |
|
|
|
|
Subtotal = fac.Subtotal, |
|
|
|
|
TotalF = fac.Total |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, commandType: CommandType.StoredProcedure); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// METODO PARA ELIMINAR DETALLES |
|
|
|
|
|
|
|
|
|
#region "METODO DELETE PARA ELIMNAR DETALLES EN LA TABLA " |
|
|
|
|
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) |
|
|
|
|
{ |
|
|
|
|
var procedimientoAlmacenadoDeleteF = "SpEliminarFactura"; |
|
|
|
@ -165,10 +171,10 @@ namespace MyFirstAPI.Repositorio |
|
|
|
|
new { Idf = Idff }, commandType: CommandType.StoredProcedure); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|