I am trying to get all records as a List from For Loop
.
Inside that For Loop
i have a query which returns single record everytime.
Below is my code:
IQueryable<MyClass> receive = null;
for (int i = 0; i < selected_items.Count(); i++)
{
var idx = order_receive_id[selected_items[i]];
receive = (from ors in db.item where ors.id ==
order_receive_idx
select new MyClass()
{
quantity = ors.receive ?? 0,
total = ors.quantity * 250 ?? 0
});
}
And then..
var com = new MyNewClass();
com.items_list = receive.ToList();
But this only shows the last record. I want all the records from above query outside the loop. I couldn't find any help according to my need.
Any help would be much appreciated.