How to bring an item list

4

I need to get a list of ITEMS , with just the Order id. The way I do is this, but it just brings me an Item, I want to be able to bring all the items I have, with the order ID.

var listaItems = new ItemRepositorio().BuscarTodos().FirstOrDefault(c => c.PedidoId == Id);
    
asked by anonymous 01.10.2016 / 21:49

2 answers

0
  public List<ClasseUsada> FindAll(int pedidoId)
    {
        using (Conexao con = new Conexao())
        {
            return con.Tabela.Where(x=>x.Pedidoid.equals(pedidoid)).ToList();
        }
    }

Good afternoon follows code with this code returns all that have passed id

    
03.10.2016 / 22:59
0

Just swap your FirstOrDefault for Where.

The FirstOrDefault returns the first object whether or not to set a condition, since Where returns all objects found in the condition.

    
01.10.2016 / 23:24