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(); }
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); }
public AirTicketViewModel(AirTicket ticket) { this.airTicket = ticket; }