68 lines
1.4 KiB
C#
68 lines
1.4 KiB
C#
using System.Runtime;
|
|
using Entidades;
|
|
|
|
namespace Modelo
|
|
{
|
|
public sealed class RepositorioCategoria : RepositorioBase<Categoria, RepositorioCategoria>
|
|
{
|
|
override public bool Add(Categoria t)
|
|
{
|
|
bool ret = false;
|
|
//commit
|
|
try
|
|
{
|
|
almacen.Add(t);
|
|
ret = true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
override public bool Mod(Categoria t)
|
|
{
|
|
bool ret = false;
|
|
|
|
try
|
|
{
|
|
var categoriaAModificar = almacen.Find(x => x.Id == t.Id);
|
|
if (categoriaAModificar != null)
|
|
{
|
|
categoriaAModificar = t;
|
|
ret = true;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
override public bool Del(Categoria t)
|
|
{
|
|
bool ret = false;
|
|
|
|
try
|
|
{
|
|
var categoriaAEliminar = almacen.Find(x => x.Id == t.Id);
|
|
if (categoriaAEliminar != null)
|
|
{
|
|
almacen.Remove(categoriaAEliminar);
|
|
ret = true;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
}
|