In Web Forms whenever I mounted some kind of CRUD , I used using to make an implen in>.
public List<Produtos> Lista ()
{
using (var ctx = new DbContext())
{
return ctx. Produtos.ToList();
}
}
In ASP.NET MVC this is done in what way?
public ActionResult Lista ()
{
DbContext ctx = new DbContext ();
return View ( ctx. Produtos );
}