Reposfix: correjido gitignore
This commit is contained in:
73
Modelo/RepositorioFactura.cs
Normal file
73
Modelo/RepositorioFactura.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime;
|
||||
using Entidades;
|
||||
|
||||
namespace Modelo
|
||||
{
|
||||
public sealed class RepositorioFactura : RepositorioSingleton<Factura, RepositorioFactura>
|
||||
{
|
||||
override public bool Add(Factura t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
almacen.Add(t);
|
||||
ret = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
override public bool Mod(Factura t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
var facturaAModificar = almacen.Find(x => x.Id == t.Id);
|
||||
if (facturaAModificar != null)
|
||||
{
|
||||
facturaAModificar = t;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
override public bool Del(Factura t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
var facturaAEliminar = almacen.Find(x => x.Id == t.Id);
|
||||
if (facturaAEliminar != null)
|
||||
{
|
||||
almacen.Remove(facturaAEliminar);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<DetalleFactura> MostrarDetalles(Factura factura)
|
||||
{
|
||||
return factura.MostrarDetalles();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user