empezé a hacer cosas con el dbcontext, termine la clase de repositorio y añadi/implemente los skeleton de varios repositorios

This commit is contained in:
2024-08-14 02:27:25 -03:00
parent 3f526d09d6
commit 505ff5004e
12 changed files with 441 additions and 49 deletions

32
Modelo/Repositorio.cs Normal file
View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.ObjectModel;
using System.Diagnostics.Contracts;
namespace Modelo
{
public class Repositorio<T>
{
protected Context context;
public IEnumerable<T> Listar();
public abstract T ObtenerPorId(int Tid);
public abstract void Add(T t);
public abstract void Del(T t);
public abstract void Mod(T t);
public bool Guardar()
{
bool ret = false;
try
{
context.SaveChanges();
ret = true;
}
catch (DbUpdateException)
{
throw;
}
return ret;
}
}
}