Hello LinQ experts,
I have a problem with the query(in cap) below. It should be straightforward and simple but for some reason, it doesn't return the correct results. Please see below:
------------------------------------------------------------------
AdminConnection db2 = new AdminConnection();
IQueryable
IEnumerable
if (User.IsInRole("Administrator"))
{
menusList = getMenu.OrderBy(i => i.Id).ThenBy(l => l.Level).ThenBy(p => p.Position).ToList(); // this query works fine.
}
else
{
menusList = getMenu.OrderBy(i => i.Id).ThenBy(l => l.Level).ThenBy(p => p.Position).Where(m => !m.GroupPermission.Contains("GroupAdmin") && !m.Permission.Contains("Administrator")).ToList(); // THIS QUERY DOESN'T WORK. It only returns 1 record when it should returns at least 3 records based on the current data.
}
---------------------------------------------------------
Would someone please tell me what am I missing here? My LinQ query above is incorrect? Please point me in the right direction.
Thank you.

Nilesh ShahPosted Jul 7, 2017, 11:57 AM
BlumondePosted Jul 7, 2017, 12:20 PM