public OperationStatistique() { this.UsersList = new ObservableCollection <statistique>(); var x = from f in dcd.Filiere join e in dcd.etudiant on f.Id_filiere equals e.id_fil group new { e, f } by new { f.Nom_filiere } into g select new { nomFil = g.Key.Nom_filiere, nbrEtu = g.Count() }; var y = from f in dcd.Filiere join e in dcd.etudiant on f.Id_filiere equals e.id_fil into outerJoin from j in outerJoin.DefaultIfEmpty() where j.id_fil == null select new { nomFil = f.Nom_filiere }; foreach (var i in x) { statistique f = new statistique(); f.NombreEtudiant = i.nbrEtu; f.NomFiliere = i.nomFil; UsersList.Add(f); } foreach (var i in y) { statistique f = new statistique(); f.NombreEtudiant = 0; f.NomFiliere = i.nomFil; UsersList.Add(f); } }
public statistique statistique() { statistique s = new statistique(); s.nbrFreelancer = utOfWork.UserRepository.GetMany(u => u.DTYPE.Equals("freelancer")).Count(); s.nbrJobOwner = utOfWork.UserRepository.GetMany(u => u.DTYPE.Equals("jobowner")).Count(); return(s); }