Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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();
     }
 }
Exemplo n.º 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //var s = "asdasdas";
            //var q = s.Where(c => c > 'a').OrderBy(c =>c).ToArray();

            using (var db = new WormGameEntities())
            {
                //var query = from r in db.GameResults
                //            where r.Player.StartsWith(txtSearch.Text)
                //            orderby r.Score descending
                //            //select new { r.Id, Gracz=r.Player, Wynik = r.Score };
                //            select r;

                var query = db.GameResults.Where(r => r.Player.StartsWith(txtSearch.Text))
                            .OrderByDescending(r => r.Score);
                //.Select(r => r);
                var res = query.ToArray();
                SerializeJson(res);
                Serialize(res);

                lstResults.ItemsSource = res;
            }
        }