Reputation: 11330
I have 2 linq statements, below
// Extracts a list of int from List<BookmarkedDeal>
IEnumerable<int> IDs = user.BookmarkedDeals.Select(d => d.DealId);
// Calls method to return List<Deal> using IDs from previous statement
IEnumerable<Deal> deals = DealBL.FindActiveById(IDs).OrderBy(d => d.Store.Name);
I think it's possible but I can't get my head around it at the moment.
Upvotes: 3
Views: 70
Reputation: 3425
Just in case you want to have an idea about how it would be doing the same with the query syntax:
var deals = from d in DealBL.FindActiveById(
from d in user.BookmarkedDeals
select d.DealId
)
orderby d.Store.Name
select d;
Upvotes: 2
Reputation: 174299
What's the problem with this?
var deals = DealBL.FindActiveById(user.BookmarkedDeals.Select(d => d.DealId))
.OrderBy(d => d.Store.Name);
Upvotes: 4