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