private void Button_Click_1(object sender, RoutedEventArgs e) { using (var db = new WormGameEntities()) { var res = (GameResults)((Button)sender).DataContext; db.Entry(res).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); Button_Click(null, null); } }
private void Button_Click(object sender, RoutedEventArgs e) { using (var db = new WormGameEntities()) { var result = new GameResults() { Player = _game.LoginName, Score = _game.Points, DT = DateTime.Now }; db.GameResults.Add(result); db.SaveChanges(); } }