private void RemoveEmployeeFromDB(Employee employee) { using (BusStationDatabase db = new BusStationDatabase()) { db.Employee.Remove(employee); db.SaveChanges(); } }
public static void BuyTicket(Ticket ticket) { using (BusStationDatabase db = new BusStationDatabase()) { db.Ticket.Add(ticket); db.SaveChanges(); } }
public static bool Registration(Client client) { using (BusStationDatabase db = new BusStationDatabase()) { db.Client.Add(client); try { db.SaveChanges(); return(true); } catch (DbUpdateException) { return(false); } } }
private bool AddNewEmployee(Employee employee) { using (BusStationDatabase db = new BusStationDatabase()) { try { db.Employee.Add(employee); db.SaveChanges(); return(true); } catch (DbUpdateException) { return(false); } } }