c# - How to select both boolean values or one -


i have ternary operator below linq query shown

 var sub = (subordinationtype == 1) ? (true&false) : false;  var query = vw in dbcontext.vw                             (vw.office == fieldoffice && vw.subagreement == sub)                             select vw; 

here subagreement bit field in database need select both true , false(0,1) or false(0) based on ternery how achieve this?

any quick suggestions please.

try like:

var query = vw in dbcontext.vw             vw.office == fieldoffice             select vw;  if (subordinationtype != 1) {     query = query.where(vw => vw.subagreement == false); } 

in linq it's easy add new where clauses in && other clauses (note it's easy add if want them in &&, || case more complex! :-) )


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -