What is the problem with my code below? It’s not returning any items even when matching records are present in the database. If it’s wrong, how can I convert my IQueryable to IEnumerable?
public IEnumerable<TimelineItem> TimeLineItems { get; set; }
public IEnumerable<TimelineItem> GetTimeLineItems(int SelectedPID)
{
TimeLineItems = (from t in db.TimelineItems
where t.ProductID == SelectedPID
select new { t.Description, t.Title }) as IEnumerable<TimelineItem>;
return TimeLineItems;
}
In my opinion, if you are going to use linq then embrace it, get rid of that esoteric notation 🙂