Click here to Skip to main content
15,042,088 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public List<settingsviewmodel> ActivemoduleList(decimal OrgID)
return (from module in db.lookupmodules
where module.OrganizationId == OrgID || module.OrganizationId == OrgID && module.IsActive == false || module.OrganizationId == OrgID && module.IsActive == false
select new SettingsViewModel
ModuleId = module.ModuleID,
ModuleName = module.ModuleName,
DateCreated = module.DateCreated,
DateModified = module.DateModified,
statusName = module.IsActive,
SetDefault = module.IsDefault,

What I have tried:

i am tried to solve where condition where only first value is i have picked .i want every condition pick our value.
Updated 15-May-18 4:41am

1 solution

Try bracketing the expression so it explicitly says what you want: && has a higher precedence than || so
A || b && c
is evaluated as
a || (b && c)
Not as
(a || b) && c
Without brackets to explicitly say what you want, you may not get it!
Member 13828340 15-May-18 10:50am
where ((module.OrganizationId == OrgID) || (module.OrganizationId == OrgID && module.IsActive == false) || (module.OrganizationId == OrgID && module.IsActive == false))
Richard Deeming 15-May-18 12:13pm
Perhaps I'm missing something, but that condition doesn't make much sense.

You've currently got: A || (A && B) || (A && B)

Aside from the duplicate (A && B) condition, you don't even need the || - if A is true, then the result is true, and if A is false, then A && B is false, so the result is false.

Your entire condition can be reduced to: where module.OrganizationId == OrdID

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900