var q = from e in ... select e if ( pays !string.empty) q from e in q where e.pays = pays.contaisn(pays.name) select e if ( ville!string.empty) q from e in q where e.ville = ville.contaisn(ville.name) select e ..etc...
from e in q where e.ville = ville.contaisn(ville.name) && e.pays = pays.contaisn(pays.name) select e
GetAllEmploye(string nom, string pays, char sexe, int idSociete) { if(String.IsNullOrEmpty(nom) || String.IsNullOrEmpty(pays)) return ...; //Dépéndant de ton type de retour de la méthode. DataContextGlobal db.... }
GetAllEmploye(string nom, string pays, char sexe, int idSociete) { //pré-conditions DataContextGlobal db = new DataContextGlobal(connexion); var rqt = from emp in db.TableEmploye where (e.nom != null && e.nom.Contains(nom)) && (e.pays != null && e.pays.Contains(pays)) ... select emp }
var q = from e in ... select e if ( pays !string.empty) q from e in q where e.pays = pays.contaisn(pays.name) select e ......
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar q = from e in db.TableEmploye select e if ( !String.IsNullOrEmpty(nom) ) q from e in q where e.nom nom select e if ( !prenom.IsNullOrEmpty(prenom) ) q from e in q where e.prenom prenom select e if ....