más cambios ahora funciona el tema de las facturas pero no el emailer

This commit is contained in:
fedpo
2024-10-01 02:48:17 +01:00
parent 37ff7022cf
commit 76d9b597d6
30 changed files with 156 additions and 6617 deletions

View File

@@ -15,17 +15,22 @@ namespace Modelo
{
return context.Facturas
.AsNoTracking()
.Include(x=>x.Detalles)
.Include(x=>x.Cliente)
.ToList();
}
public Factura ObtenerPorId(int Tid)
{
Factura fac = context.Facturas.First(x => x.Id == Tid);
return fac ?? new Factura();
}
public override void Add(Factura t)
{
t.Cliente = context.Clientes.FirstOrDefault(x => x.Cuit == t.Cliente.Cuit);
foreach (var detalle in t.Detalles)
{
detalle.Producto = (detalle.Producto.EsPerecedero) ?
context.ProductoPercederos.FirstOrDefault(x => x.Id == detalle.Producto.Id) :
context.ProductoNoPercederos.FirstOrDefault(x => x.Id == detalle.Producto.Id) ;
}
context.Facturas.Add(t);
}
@@ -41,6 +46,13 @@ namespace Modelo
context.Facturas.Update(t);
}
public Factura ObtenerPorId(Factura fac)
{
var factura = context.Facturas
.Include(x=>x.Detalles)
.ThenInclude(x=>x.Producto)
.FirstOrDefault(x => x.Id == fac.Id);
return factura;
}
}
}