Ejemplo n.º 1
0
        private void CsgoBetsTrueBtnClick(object sender, MouseButtonEventArgs e)
        {
            using (BettyContextCsgo context = new BettyContextCsgo())
            {
                int id = Convert.ToInt32((CsgoBetsList.SelectedItem as ListBoxItem)
                    .Content.ToString().Split(new char[] { '.' })[0]);

                context.csgo_bets.First(b => b.Id == id).IsTrue = true;

                context.SaveChanges();

                CsgoInfo.Bets = context.csgo_bets.AsEnumerable().ToList();
            }

            FillCsgoBetsList();
            CsgoBetResultLbl.Content = "";
        }
Ejemplo n.º 2
0
        private void CsgoBetsSaveBtnClick(object sender, MouseButtonEventArgs e)
        {
            using (BettyContextCsgo context = new BettyContextCsgo())
            {
                context.csgo_bets.Add(new CsgoBets
                    {
                        Date = DateTime.Now,
                        FirstTeamId = LastResult.FirstTeamId,
                        SecondTeamId = LastResult.SecondTeamId,
                        Chance = LastResult.FirstTeamChance,
                        IsTrue = false,
                        WinnerTeamId = LastResult.FirstTeamChance >= 50f
                            ? LastResult.FirstTeamId
                            : LastResult.SecondTeamId
                    });
                context.SaveChanges();

                List<CsgoBets> bets = context.csgo_bets.AsEnumerable().ToList();
                CsgoInfo.Bets = bets;
            }

            FillCsgoBetsList();
            CsgoBetsSaveBtn.Visibility = Visibility.Hidden;
        }