Files
AlquilaFacil/Modelo/RepositorioBase.cs
2024-12-04 17:44:25 -03:00

26 lines
619 B
C#

using Entidades;
namespace Modelo;
public abstract class RepositorioBase<S>
where S : new()
{
protected AlquilaFacilContext Context { get { return new AlquilaFacilContext(); }}
private static readonly S instance = new();
public static S Singleton { get { return instance; }}
public bool Guardar(AlquilaFacilContext context) {
bool ret = false;
try
{
context.SaveChanges();
context.Dispose();
ret = true;
} catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
}
return ret;
}
}