Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Repository_General
public class Repository_General: IRepositorioGeneral, IDisposable
{
...
public SeuModeloDeDados db = new SeuModeloDeDados();
private bool disposed = false;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~Repository_General()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
if (this.db != null)
{
this.db.Dispose();
this.db = null;
}
}
}
}
public List<VideosRetornados> RetornaQuatroVideosMaisRecentes()
{
try
{
var RetornoVideo = (from v in db.SeusVideos
orderby v.IDVideo descending
select new VideosRetornados
{
_Titulo = v.TituloVideo,
_CaminhoImagem = v.CaminhoBreadcrumbVideo,
_LinkExterno = v.LinkExternoParaOVideo
}).Take(4).ToList();
return RetornoVideo;
}
catch (EntitySqlException ex)
{
throw new Exception(ex.Message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment