0
I need to bring only 6 records from the database to show in the View, instead of bringing only 6 records, bringing all.
The code is as follows::
public PartialViewResult Cursos()
{
ViewBag.Cursos = new CursoRepositorio().BuscarTodos().Take(6).ToArray();
return PartialView();
}
Can you show the find all function? and the partial view
– Lucas
To seek all is
public IEnumerable<TEntity> BuscarTodos()
 {
 return Db.Set<TEntity>().ToList();
 }
and the partial view only has a foreach that assembles you with the 6 data of the bank, nothing more– Alysson bormann
Big mistake!!! once you have been in the database and returned all the data ((((Return Db.Set<Tentity>().Tolist()))) try to change this with the amount you want before launching the query against the database.
– Marco Souza
Another major failure caused by trying to implement Repository Pattern on top of EF.
– Jéf Bueno