예제 #1
0
        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();
        }
예제 #2
0
        private void AddItem()
        {
            db = new TicketsContext();
            db.Lexturys.Load();
            Random  rand   = new Random();
            Lextury ticket = new Lextury();

            ticket.Title      = Title;
            ticket.Count      = rand.Next(1, 100);
            ticket.Date       = Date;
            ticket.NameLector = Type;

            db.Lexturys.Add(ticket);

            db.SaveChanges();
            db.Dispose();
            MessageBox.Show("Добавили " + ticket.Title);
        }
예제 #3
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            //List<AirTicket> airTickets = new List<AirTicket>()
            //{
            //new AirTicket(1, "Москва-Минск", "21.05.2018", "Бизнес класс", 5),
            //new AirTicket(2, "Борисполь-Хургада", "13.12.2018", "Эконом класс", 2),
            //new AirTicket(3, "Минск-Лондон", "30.07.2018", "Бизнес класс", 4)
            //};

            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();
        }