Reposfix: correjido gitignore
This commit is contained in:
67
Modelo/RepositorioCategoria.cs
Normal file
67
Modelo/RepositorioCategoria.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Runtime;
|
||||
using Entidades;
|
||||
|
||||
namespace Modelo
|
||||
{
|
||||
public sealed class RepositorioCategoria : RepositorioSingleton<Categoria, RepositorioCategoria>
|
||||
{
|
||||
override public bool Add(Categoria t)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user