public IEnumerable<string> ListJedi()
 {
    List<Jedi> listJedi;
    DalManager dal = new DalManager();
    listJedi = dal.GetJedi();
    IEnumerable<string> stringJedi;
    stringJedi = from jedi in listJedi select jedi.Nom;
    return stringJedi;
 }
 public IEnumerable<string> AfficheSith()
 {
    IEnumerable<string> stringSith;
    List<Jedi> listJedi;
    DalManager dal = new DalManager();
    listJedi = dal.GetJedi();
    stringSith = from sith in listJedi where sith.IsSith == true select sith.Nom;
    return stringSith;
 }
 public IEnumerable<string> AfficheJediFort()
 {
    IEnumerable<string> stringJediFort;
    List<Jedi> listJedi;
    DalManager dal = new DalManager();
    listJedi = dal.GetJedi();
    stringJediFort = from jedifort in listJedi
                     where jedifort.Carac[0].Valeur > 3 && jedifort.Carac[2].Valeur > 50
                     select jedifort.Nom;
    return stringJediFort;
 }
      public void launchDemi(List<ViewModelMatch> listMatch)
      {
         DalManager dalM = new DalManager();
         List<Jedi> jedis = dalM.GetJedi();
         List<ViewModelMatch> listDemi = new List<ViewModelMatch>();
         List<Jedi> vainqueurs = new List<Jedi>();
         Random rnd = new Random();

         listDemi = (from match in listMatch
                     where match.PhaseTournoi == EPhaseTournoi.DemiFinale
                     orderby match.Match.Id ascending
                     select match).ToList();

         foreach (ViewModelMatch match in listDemi)
         {
            int r = rnd.Next(1, 100);
            JouerAuto(match.Match, r);
            vainqueurs.Add((from jedi in jedis
                            where jedi.Id == match.Match.IdJediVainqueur
                            select jedi).First());
         }
         Stade stade = dalM.GetStade().First();
         int i = 0;
         // 2 matches de quart de demi-final

         while (i < 2)
         {
            //creer les nouveaux matches
            // TODO:  faire que les id des matches s'incrémentent automatiquement
            // mettre dans la base de données tt ça
            //new Match(null, listVainqueurs[i], listVainqueurs[i + 1], EPhaseTournoi.DemiFinale, new Stade(), 9);
            listMatch.Add(new ViewModelMatch(new Match(1, vainqueurs[i], vainqueurs[i + 1], EPhaseTournoi.Finale, stade, i + 8)));

            i += 2;
         }

      }
      public List<ViewModelJedi> getAllJediModel()
      {
         List<ViewModelJedi> list = new List<ViewModelJedi>();
         var manager = new DalManager();
         var jedis = manager.GetJedi();
         foreach (Jedi jeds in jedis)
         {
            list.Add(new ViewModelJedi(jeds));
         }

         return list;
      }
      public List<Jedi> ListJediInfo()
      {
         DalManager dal = new DalManager();

         return dal.GetJedi();
      }