public void Delete(int id) { using (Ticket_DbContext context = new Ticket_DbContext()) { context.Tickets.Remove(context.Tickets.Find(id)); context.SaveChanges(); } }
public int Create(Ticket obj) { using (Ticket_DbContext context = new Ticket_DbContext()) { context.Tickets.Add(obj); context.SaveChanges(); return(obj.Id); } }
public void Update(Ticket obj) { using (Ticket_DbContext context = new Ticket_DbContext()) { Ticket old_ticket = context.Tickets.Find(obj.Id); old_ticket.EventName = obj.EventName; old_ticket.Price = obj.Price; context.SaveChanges(); } }