public static void SaveScore(Database.HighScore hs) { using (var context = new Database.ALTPContext(ConnectionString)) { context.HighScores.InsertOnSubmit(hs); context.SubmitChanges(); } }
public ConnectDatabase() { using (var context = new Database.ALTPContext(ConnectionString)) { if (!context.DatabaseExists()) { context.CreateDatabase(); } } }
public static IList <Database.Question> GetQuestionLevel(int level) { IList <Database.Question> quesList = null; using (var context = new Database.ALTPContext(ConnectionString)) { IQueryable <Database.Question> t = from ques in context.Questions where ques.QUESTION_NO == level select ques; quesList = t.ToList(); } return(quesList); }
public static ObservableCollection <Database.HighScore> GetHighScore() { var highList = new ObservableCollection <Database.HighScore>(); using (var context = new Database.ALTPContext(ConnectionString)) { var t = from h in context.HighScores orderby h.Score descending select h; if (t != null) { foreach (var item in t) { highList.Add(item as Database.HighScore); } } else { highList = null; } } return(highList); }