private void OnStartup(object sender, StartupEventArgs e) { db = new TicketsContext(); db.Lexturys.Load(); List <Lextury> lexturys = db.Lexturys.ToList(); MainWindow view = new MainWindow(); MainViewModel viewModel = new MainViewModel(lexturys); view.DataContext = viewModel; view.Show(); }
private void GiveItem() { Count--; db = new TicketsContext(); db.Lexturys.Load(); Lextury ticket = new Lextury(); ticket = db.Lexturys.Find(Id); ticket.Count = Count; db.SaveChanges(); db.Dispose(); }