예제 #1
0
 public string SaveScore(string Pseudo, string Score)
 {
     using (Database1Entities context = new Database1Entities())
     {
         Score s    = new Score();
         Score temp = new Score();
         temp     = context.Score.Select(x => x).ToList().Last();
         s.Id     = temp.Id + 1;
         s.pseudo = Pseudo;
         s.score1 = Convert.ToInt32(Score);
         context.Score.Add(s);
         context.SaveChanges();
     }
     return("Score sauvegardé!");
 }
예제 #2
0
        public List <Podium> RecupResultat(string size)
        {
            List <Podium> p = new List <Podium>();

            for (int i = 0; i < Convert.ToInt32(size); i++)
            {
                p.Add(new Podium());
            }
            using (Database1Entities context = new Database1Entities())
            {
                List <Score> s = context.Score.Select(x => x).OrderByDescending(x => x.score1).ToList();
                for (int i = 0; i < Convert.ToInt32(size) && i < s.Count; i++)
                {
                    p[i].Pseudo = s[i].pseudo;
                    p[i].Score  = s[i].score1.ToString();
                }
            }
            return(p);
        }