Пример #1
0
 private static void savePoints(string playerName, int maxPoints, int maxAttempts)
 {
     using (var context = new diceGameStatsEntities2())
     {
         context.Set <rankingStorage>()
         .Add(new rankingStorage
         {
             attempts = maxAttempts,
             points   = maxPoints,
             username = playerName,
         });
         context.SaveChanges();
     }
 }
Пример #2
0
        private void loadData()
        {
            using (var context = new diceGameStatsEntities2())
            {
                var query = context.rankingStorage.ToList()
                            .Select(x =>
                                    new
                {
                    Player   = x.username,
                    Points   = x.points,
                    Attempts = x.attempts
                }).OrderByDescending(x => x.Points).ToList();

                rankingDataGrid.DataSource = query;
            }
        }