Guest User

Untitled

a guest
Aug 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Error getting foreign key data on entity
  2. public class Repository
  3. {
  4. public IQueryable<Produto> ListAllProducts()
  5. {
  6. return entities.Produtos;
  7. }
  8. }
  9.  
  10. public class AdminProdutoController : Controller
  11. {
  12.  
  13. TudoDeMassinhaRepository repository = new TudoDeMassinhaRepository();
  14.  
  15. public ActionResult Index()
  16. {
  17. var produtos = repository.ListAllProducts().ToList();
  18. return View(produtos);
  19. }
  20. }
  21.  
  22. public IQueryable<Produto> ListAllProductsWithCategories()
  23. {
  24. return entities.Produtos.Include("CatProduto");
  25. }
  26.  
  27. public ActionResult Index()
  28. {
  29. var produtos = repository.ListAllProductsWithCategories().ToList();
  30. return View(produtos);
  31. }
Add Comment
Please, Sign In to add comment