score:1

Accepted answer

Usually, the approach for filtering data like this is with cumulative query composition; for example:

IQueryable<PSearchModel> query =
    from kb in db.kimlik_bilgileri
    join dbilgi in db.dil_bilgisi on kb.id equals dbilgi.KimlikId
    join okbil in db.okul_bilgileri on kb.id equals okbil.KimlikId
    join kurbil in db.kurum_bilgileri on kb.id equals kurbil.KimlikId
    join ens in db.enstitu on kurbil.kurum_id equals ens.id
    join kadr in db.kadro_unvan on kurbil.kadro_id equals kadr.id
    where kb.Aktifmi == true
    select new PSearchModel
    {
        DilBilgisi = dbilgi,
        // Diller =  dil,
        OkulBilgileri = okbil,
        KadroUnvan = kadr,
        Enstitu = ens,
        KimlikBilgileri = kb,
        KurumBilgileri = kurbil
    };

if (!yabanciDil.IsNullOrWhiteSpace())
{
    int dil_di = Convert.ToInt32(yabanciDil);
    query = query.Where(o => o.DilBilgisi.dil_id == dil_di);
}
// ... add other filters here

var list = query.ToList();

This defers all execution to the end, and allows you to inspect dil_di when debugging, to see if it is what you expect. If you still don't get what you expect, then you'll have to investigate what SQL is being issued, to see why your results are different from your expectations.

score:1

You could search in your List with LINQ as well. One possibility is this:

YourListObject.Where(c=>c.Test.Equals("Hallo"))

Also possible to Order or Group by equivalent to this.


Related Articles