c# - how do i use the list functions for the linq query? -


i'm making query , want search db "branchid" (pic2) in "rentsorder" (pic2) table add dot in query after rentsorders (pic1) list of collection functions , don't know how use them go on list , find barnchid equals branchid prop

you can see in cartype when added dot did "year" prop

pic1

pic2

try following:

var query _db.cars     .where     (         z => z.cartype.year == year &&         z.cartype.gear == gear &&             z.rentorders             .max             (                 x => x.actualenddate             ) < startrent &&             z.rentorders             .max             (                 x => x.actualenddate             ) < endrent &&         z.cartype.manufacture.manufacturename == manufacturename &&         z.rentorders.where(x => x.branchid == branchid).tolist()     ).tolist(); 

i recommend try more acquainted lambda , linq. => lambda operator allows access single instance properties of object. how use z, or x access properties of associated objects.

so have collection of rentorders, single instance 1 of in collection.

refer following further detail: => operator (c# reference)


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -