public async Task <bool> SaveRecord() { bool bOK = true; try { using (var db = new DbContextScores()) { db.Scores.Add(this); await db.SaveChangesAsync(); } } catch (Exception ex) { Logger.Instance.Error($"SaveRecord exception, {ex.Message}"); bOK = false; } return(bOK); }
// delete all scores internal static async Task <bool> DeleteAllRecords() { bool bOK = true; try { using (var db = new DbContextScores()) { foreach (var score in db.Scores) { db.Scores.Remove(score); } await db.SaveChangesAsync(); } } catch (Exception ex) { Logger.Instance.Error($"DeleteAllRecords exception, {ex.Message}"); bOK = false; } return(bOK); }