Doubt when searching for items with Entity

Asked

Viewed 45 times

0

Guys, I have to pick up all the sales items concretized. Every item is recorded with a CART in a sale, in the sales table I have the CART. 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 in the realized sales table! Help me :(

  • Tried to include in the concrete sales chart?

1 answer

0


I decided otherwise.

public Static List Buscaritensporvendaid() { Return ctx.Vendas.Tolist(); }

Just pull up the whole table and deal with it in the view'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.