var feedList =
((from video in context.Video
orderby video.Date descending
select new { TypeID = video.VideoID, CodeID = video.CodeID, Date = video.Date }).Take(50))
.Union((from comment in context.Comment
orderby comment.Date descending
select new { TypeID = comment.CommentID, CodeID = comment.CodeID, Date = comment.Date }).Take(50))
.Union((from share in context.Share
orderby share.DateTime descending
select new { TypeID = share.ShareID, CodeID = (int?)share.CodeID, Date = share.DateTime }).Take(50))
.Union((from events in context.Event
orderby events.CreateDate
select new { TypeID = events.EventID, CodeID = events.CodeID, Date = events.CreateDate }).Take(50))
.ToList();
foreach (var f in feedList)
{
var feed = new FeedListItemsContract();
{
feed.TypeId = f.TypeID;
var blCode = new BLCode();
feed.CodeName = blCode.GetCodeNameById((int)f.CodeID);
feed.Date = f.Date;
}
result.Add(feed);
}
var resultSorted = result.OrderByDescending(s => s.Date).ToList();
return resultSorted;
that's what I needed to do to make it work..
important is that every select returns the same ammount of tables!
thanks for the help!