Hecho Irepositorio y borrado codigo viejo de repositorios. Además configuré entity framework
This commit is contained in:
@@ -3,85 +3,8 @@ using Entidades;
|
||||
|
||||
namespace Modelo
|
||||
{
|
||||
public sealed class RepositorioOrdenDeCompra : RepositorioBase<OrdenDeCompra, RepositorioOrdenDeCompra>
|
||||
public sealed class RepositorioOrdenDeCompra : IRepositorio<OrdenDeCompra>
|
||||
{
|
||||
override public bool Add(OrdenDeCompra t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
almacen.Add(t);
|
||||
ret = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
override public bool Mod(OrdenDeCompra t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
var ordenAModificar = almacen.FindIndex(x => x.Id == t.Id);
|
||||
if (ordenAModificar > -1)
|
||||
{
|
||||
almacen[ordenAModificar] = t;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
override public bool Del(OrdenDeCompra t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
var ordenAEliminar = almacen.Find(x => x.Id == t.Id);
|
||||
if (ordenAEliminar != null)
|
||||
{
|
||||
almacen.Remove(ordenAEliminar);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<DetalleOrdenDeCompra> MostrarDetalles(OrdenDeCompra orden)
|
||||
{
|
||||
return orden.MostrarDetalles();
|
||||
}
|
||||
|
||||
public bool MarcarEntregado(OrdenDeCompra orden)
|
||||
{
|
||||
bool ret = false;
|
||||
if (orden == null) return ret;
|
||||
if (orden.Id < 0) return ret;
|
||||
if (orden.Entregado == false) return ret;
|
||||
var ordenAModificar = almacen.FindIndex(x => x.Id == orden.Id);
|
||||
if (ordenAModificar > -1)
|
||||
{
|
||||
almacen[ordenAModificar].Entregado = true;
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user