Example #1
0
        public string InsertNewPlayer(string name, int score)
        {
            try
            {
                string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                                             "HangmanDB.sqlite");
                var db   = new SQLiteConnection(dbPath);
                var item = new Resources.PlayerScore();
                item.Name  = name;
                item.Score = score;

                db.Insert(item);
                return("You have been added to the database");
            }
            catch (Exception ex)
            {
                return("Error : " + ex.Message);
            }
        }
Example #2
0
        public string DeletePlayer(int id)
        {
            try
            {
                string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                                             "HangmanDB.sqlite");
                var db   = new SQLiteConnection(dbPath);
                var item = new Resources.PlayerScore();
                item.Id = id;


                db.Delete(item);
                return("You have been added to the database");
            }
            catch (Exception ex)
            {
                return("Error : " + ex.Message);
            }
        }
Example #3
0
        public string UpdateScore(int id, string name, int score)//score database//
        {
            try
            {
                string dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                                             "HangmanDB.sqlite");
                var db   = new SQLiteConnection(dbPath);
                var item = new Resources.PlayerScore();

                item.Id    = id;
                item.Name  = name;
                item.Score = score;

                db.Update(item);
                return("Record Updated...");
            }
            catch (Exception ex)
            {
                return("Error : " + ex.Message);
            }
        }