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
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
Post a Comment