repositorios

This commit is contained in:
Nacho
2024-04-04 22:52:14 -03:00
parent 5d29abefe6
commit 4584ea6529
36 changed files with 1110 additions and 2 deletions

View File

@@ -0,0 +1,75 @@
using System.Collections.ObjectModel;
using System.Runtime;
using Entidades;
namespace Modelo
{
public sealed class RepositorioPresupuesto : RepositorioSingleton<Presupuesto, RepositorioPresupuesto>
{
override public bool Add(Presupuesto t)
{
bool ret = false;
try
{
almacen.Add(t);
ret = true;
}
catch (Exception)
{
throw;
}
return ret;
}
override public bool Mod(Presupuesto t)
{
bool ret = false;
try
{
var presupuestoAModificar = almacen.Find(x => x.Id == t.Id);
if (presupuestoAModificar != null)
{
presupuestoAModificar = t;
ret = true;
}
}
catch (Exception)
{
throw;
}
return ret;
}
override public bool Del(Presupuesto t)
{
bool ret = false;
try
{
var presupuestoAEliminar = almacen.Find(x => x.Id == t.Id);
if (presupuestoAEliminar != null)
{
almacen.Remove(presupuestoAEliminar);
ret = true;
}
}
catch (Exception)
{
throw;
}
return ret;
}
public ReadOnlyCollection<DetallePresupuesto> MostrarDetalles(Presupuesto presupuesto)
{
return presupuesto.MostrarDetalles();
}
}
}