76 lines
1.7 KiB
C#
76 lines
1.7 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|