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(); } }
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; } }