asp.net mvc - Error occuring in LINQ statement in MVC controller -


i developing mvc app.

i trying write linq statement in controller, giving error...

 viewbag.companyidlist = new selectlist(db.companies.orderby(t => t.name).where(t=>t.isdeleted!=true || t=>t.istransfer !=true) , "id", "name"); 

whats issue ?

issue solved, mystere man

   viewbag.companyidlist = new selectlist(db.companies.orderby(t => t.name).where(t => (t.isdeleted == false || t.isdeleted == null) && (t.istransfered == false || t.istransfered == null)), "id", "name");  

the problem says t not exist caused this:

.where(t=>t.isdeleted!=true || t=>t.istransfer !=true)  

this should be:

.where(t=>t.isdeleted!=true || t.istransfer !=true)  

you use lambda once in expression. in fact, can shorten this:

.where(t => !t.isdeleted || !t.istransfer)  

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -