c# - how to getList of entity Type using Where Clause -


in case want list of enity type particular id match.

here's code can 1 tell me correct code how can achieve 1 can write proper code how can acheive.

here code

public static list<institute> getinstitutions(long orgid) {     using (schoolgapentities1 db = new schoolgapentities1())     {          if (db.institutes.any(i => i.ins_fk_orgid == orgid))          {              return db.set<institute>().where(i => i.ins_fk_orgid == orgid).tolist();          }     }     // return db.set<institute>().where(i => i.ins_fk_orgid == orgid).tolist(); } 

just use where method expression:

public static list<institute> getinstitutions(long orgid) {     using (schoolgapentities1 db = new schoolgapentities1())     {         return db.institutes.where(i => i.ins_fk_orgid == orgid).tolist();     } } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -