示例#1
0
        private void GiveItem()
        {
            Count--;
            db = new TicketsContext();
            db.AirTickets.Load();
            AirTicket ticket = new AirTicket();

            ticket       = db.AirTickets.Find(Id);
            ticket.Count = Count;
            db.SaveChanges();
            db.Dispose();
        }
示例#2
0
        private void AddItem()
        {
            db = new TicketsContext();
            db.AirTickets.Load();
            Random    rand   = new Random();
            AirTicket ticket = new AirTicket();

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

            db.AirTickets.Add(ticket);
            db.SaveChanges();
            db.Dispose();
            Console.WriteLine("che nit" + ticket.Title);
        }
示例#3
0
 private void Application_Exit(object sender, ExitEventArgs e)
 {
     db.Dispose();
 }