44 lines
976 B
C#
44 lines
976 B
C#
using System.Collections.ObjectModel;
|
|
using Entidades;
|
|
|
|
namespace Modelo
|
|
{
|
|
public sealed class RepositorioFactura : Repositorio<Factura>
|
|
{
|
|
public RepositorioFactura(Context context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
|
|
public override List<Factura> Listar()
|
|
{
|
|
return context.Facturas.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)
|
|
{
|
|
context.Facturas.Add(t);
|
|
}
|
|
|
|
public override void Del(Factura t)
|
|
{
|
|
Factura fac = context.Facturas.First(x => x.Id == t.Id);
|
|
if (fac == null) return;
|
|
context.Facturas.Remove(fac);
|
|
}
|
|
|
|
public override void Mod(Factura t)
|
|
{
|
|
context.Facturas.Update(t);
|
|
}
|
|
|
|
|
|
}
|
|
}
|