public void AddAuto(Auto auto)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         context.AddToAutos(auto);
         context.SaveChanges();
     }
 }
 public void AddKunde(Kunde kunde)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         context.AddToKunden(kunde);
         context.SaveChanges();
     }
 }
 public void AddResevation(Reservation reservation)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         context.AddToReservationen(reservation);
         context.SaveChanges();
     }
 }
 public void CreateReservation(Reservation created)
 {
     using (var ctx = new AutoReservationEntities())
     {
         ctx.AddToReservationen(created);
         ctx.SaveChanges();
     }
 }
 public void CreateKunde(Kunde created)
 {
     using (var ctx = new AutoReservationEntities())
     {
         ctx.AddToKunden(created);
         ctx.SaveChanges();
     }
 }
 public void CreateAuto(Auto created)
 {
     using (var ctx = new AutoReservationEntities())
     {
         ctx.AddToAutos(created);
         ctx.SaveChanges();
     }
 }
 public void DeleteAuto(Auto auto)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         context.Autos.Attach(auto);
         context.Autos.DeleteObject(auto);
         context.SaveChanges();
     }
 }
 public void DeleteReservation(Reservation reservation)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         context.Reservationen.Attach(reservation);
         context.Reservationen.DeleteObject(reservation);
         context.SaveChanges();
       }
 }
 public void DeleteReservation(Reservation res)
 {
     using (var ctx = new AutoReservationEntities())
     {
         ctx.Reservationen.Attach(res);
         ctx.Reservationen.DeleteObject(res);
         ctx.SaveChanges();
     }
 }
 public void DeleteKunde(Kunde kunde)
 {
     using (var ctx = new AutoReservationEntities())
     {
         ctx.Kunden.Attach(kunde);
         ctx.Kunden.DeleteObject(kunde);
         ctx.SaveChanges();
     }
 }
 public void DeleteAuto(Auto auto)
 {
     using (var ctx = new AutoReservationEntities())
     {
         ctx.Autos.Attach(auto);
         ctx.Autos.DeleteObject(auto);
         ctx.SaveChanges();
     }
 }
 public void DeleteKunde(Kunde kunde)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         context.Kunden.Attach(kunde);
         context.Kunden.DeleteObject(kunde);
         context.SaveChanges();
     }
 }
 public void DeleteReservation(Reservation reservationDelete)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Reservationen.Attach(reservationDelete);
             context.DeleteObject(reservationDelete);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException ex)
         {
             throw new LocalOptimisticConcurrencyException<Reservation>(ex.Message);
         }
     }
 }
 public void DeleteKunde(Kunde kundeDelete)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Kunden.Attach(kundeDelete);
             context.DeleteObject(kundeDelete);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException ex)
         {
             throw new LocalOptimisticConcurrencyException<Kunde>(ex.Message);
         }
     }
 }
 public void DeleteAuto(Auto autoDelete)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Autos.Attach(autoDelete);
             context.DeleteObject(autoDelete);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException ex)
         {
             throw new LocalOptimisticConcurrencyException<Auto>(ex.Message);
         }
     }
 }
 public void UpdateKunde(Kunde modifiedKunde, Kunde originalKunde)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Kunden.Attach(originalKunde);
             context.Kunden.ApplyCurrentValues(modifiedKunde);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException)
         {
             throw new LocalOptimisticConcurrencyException<Kunde>("Kunde wurde bereits verändert.");
         }
     }
 }
 public void UpdateReservation(Reservation modified, Reservation original)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Reservationen.Attach(original);
             modified.EntityKey = original.EntityKey;
             context.Reservationen.ApplyCurrentValues(modified);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException e)
         {
             context.Refresh(System.Data.Objects.RefreshMode.StoreWins, modified);
             throw new LocalOptimisticConcurrencyException<Reservation>("update conflict") { Entity = modified };
         }
      }
 }
 public void UpdateAuto(Auto modifiedAuto, Auto originalAuto)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Autos.Attach(originalAuto);
             context.Autos.ApplyCurrentValues(modifiedAuto);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException)
         {
             throw new LocalOptimisticConcurrencyException<Auto>("Auto wurde bereits verändert.");
         }
     }
 }
 public void UpdateReservation(Reservation modified, Reservation original)
 {
     using (var ctx = new AutoReservationEntities())
     {
         try
         {
             ctx.Reservationen.Attach(original);
             ctx.Reservationen.ApplyCurrentValues(modified);
             ctx.SaveChanges();
         }
         catch (LocalOptimisticConcurrencyException<Kunde>)
         {
             ctx.Refresh(RefreshMode.StoreWins, original);
             ctx.SaveChanges();
         }
     }
 }
 public void EditKunde(Kunde kundeOriginal, Kunde kundeModified)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Kunden.Attach(kundeOriginal);
             context.Kunden.ApplyCurrentValues(kundeModified);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException ex)
         {
             context.Refresh(System.Data.Objects.RefreshMode.StoreWins, kundeModified);
             throw new LocalOptimisticConcurrencyException<Kunde>(ex.Message);
         }
     }
 }
 public void EditAuto(Auto autoOriginal, Auto autoModified)
 {
     using (AutoReservationEntities context = new AutoReservationEntities())
     {
         try
         {
             context.Autos.Attach(autoOriginal);
             context.Autos.ApplyCurrentValues(autoModified);
             context.SaveChanges();
         }
         catch (OptimisticConcurrencyException ex)
         {
             Console.WriteLine("AutoReservationBusinessComponent ConcurrencyException");
             context.Refresh(System.Data.Objects.RefreshMode.StoreWins, autoModified);
             throw new LocalOptimisticConcurrencyException<Auto>(ex.Message);
         }
     }
 }
 public void UpdateReservation(Reservation modifiedReservation, Reservation originalReservation)
 {
     try
     {
         using (AutoReservationEntities context = new AutoReservationEntities())
         {
             context.Reservationen.Attach(originalReservation);
             context.Reservationen.ApplyCurrentValues(modifiedReservation);
             context.SaveChanges();
         }
     }
     catch (OptimisticConcurrencyException)
     {
         throw new LocalOptimisticConcurrencyException<Reservation>("Reservation wurde bereits verändert.");
     }
 }