public List <ScoreBoard> GetData() { List <ScoreBoard> data_records; using (SnekScoreBoardEntities context = new SnekScoreBoardEntities()) { data_records = context.ScoreBoards .Take(20) .ToList(); } return(data_records); }
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); }
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(); } }