43 lines
887 B
C#
43 lines
887 B
C#
using Entidades;
|
|
|
|
namespace Modelo
|
|
{
|
|
public sealed class RepositorioLote : Repositorio<Lote>
|
|
{
|
|
public RepositorioLote(Context context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
|
|
public override List<Lote> Listar()
|
|
{
|
|
return context.Lotes.ToList();
|
|
}
|
|
|
|
public Lote ObtenerPorId(int Tid)
|
|
{
|
|
Lote lot = context.Lotes.First(x => x.Id == Tid);
|
|
return lot ?? new Lote();
|
|
}
|
|
|
|
public override void Add(Lote t)
|
|
{
|
|
context.Lotes.Add(t);
|
|
}
|
|
|
|
public override void Del(Lote t)
|
|
{
|
|
Lote lot = context.Lotes.First(x => x.Id == t.Id);
|
|
if (lot == null) return;
|
|
context.Lotes.Remove(lot);
|
|
}
|
|
|
|
public override void Mod(Lote t)
|
|
{
|
|
context.Lotes.Update(t);
|
|
}
|
|
|
|
|
|
}
|
|
}
|