Doubt when searching for items with Entity

0

Well, I have to get all the sales items done. Every item is recorded with a CARRINHOID on a sale, on the sales table I have the CARRINHOID. How do I get all these items? I made this code:

public static List<ItemVenda> BuscarItensPorVendaId()
    { 
        //Aqui ele deveria pegar todos os ID das vendas
        Venda venda = new Venda();
        string vendaId = venda.CarrinhoId;


        return ctx.ItensVenda.Include("Peca").
            Where(x => x.CarrinhoId == vendaId).ToList();
    }

It only returns the item that is in the cart and not the actual sales table! Help me: (

    
asked by anonymous 11.11.2018 / 02:41

1 answer

0

I decided otherwise.

public static List SearchItemsPorVendId ()         {            return ctx.Vendas.ToList ();         }

It was just pulling the whole table and dealing in the view ¬¬ '

    
16.11.2018 / 21:52