示例#1
0
        public List <ScoreBoard> GetData()
        {
            List <ScoreBoard> data_records;

            using (SnekScoreBoardEntities context = new SnekScoreBoardEntities())
            {
                data_records = context.ScoreBoards
                               .Take(20)
                               .ToList();
            }
            return(data_records);
        }
示例#2
0
        public List <ScoreBoard> GetTop10Scores()
        {
            List <ScoreBoard> data_records;

            using (SnekScoreBoardEntities context = new SnekScoreBoardEntities())
            {
                data_records = context.ScoreBoards
                               .OrderByDescending(e => e.id)
                               .Take(10)
                               .ToList();
            }
            return(data_records);
        }
示例#3
0
 public void save_to_db(int score, DateTime date)
 {
     using (SnekScoreBoardEntities context = new SnekScoreBoardEntities())
     {
         ScoreBoard newSave = new ScoreBoard()
         {
             Score = score,
             Date  = date
         };
         context.ScoreBoards.Add(newSave);
         context.SaveChanges();
     }
 }