List<VideoInfo> vobj = new List<VideoInfo>();
vobj = (from vid in db.VideoInfoes.Where(c => c.IsActive == true)
orderby vid.VideoId descending
select vid
).ToList();
return View(vobj);
This is the orignal Query to bring the list of all the video info. There is another table called profile which has the Profile Picture which I need along with the video Info. So after going through an article on EF I came up with some thing like this..
vobj = (from vid in db.VideoInfoes.Where(c => c.IsActive == true)
select new
{
ProfileId = vid.ProfileId,
ProfilePictureUrl = vid.ProfileInfo.ProfilePictureUrl
}
orderby vid.VideoId descending
select vid
).ToList();
return View(vobj);
ProfileId is the foreign key. But this is not even compiling..Its showing red syntax error after the closing curly brackets and orderby.