Пример #1
0
        public List <ScoreBoard> GetData()
        {
            List <ScoreBoard> data_records;

            using (SnekScoreBoardEntities context = new SnekScoreBoardEntities())
            {
                data_records = context.ScoreBoards
                               .ToList();
            }
            return(data_records);
        }
Пример #2
0
        public List <ScoreBoard> GetTop10()
        {
            List <ScoreBoard> data_records;

            using (SnekScoreBoardEntities context = new SnekScoreBoardEntities())
            {
                data_records = context.ScoreBoards
                               .OrderByDescending(e => e.Score)
                               .Take(10)
                               .ToList();
            }
            return(data_records);
        }
Пример #3
0
 public void save_to_DB(int score, DateTime date)
 {
     using (SnekScoreBoardEntities context = new SnekScoreBoardEntities())
     {
         ScoreBoard s = new ScoreBoard()
         {
             Score = score,
             Date  = date
         };
         context.ScoreBoards.Add(s);
         context.SaveChanges();
     }
 }