Ejemplo n.º 1
0
 /// <summary>
 /// Change the information about one of the dealerships
 /// </summary>
 /// <param name="carDealership">A dealership with the new information and the same id as the old one</param>
 public void Update(CarDealership carDealership)
 {
     using (carDealershipContext)
     {
         var item = carDealershipContext.CarDealerships.Find(carDealership.Id);
         if (item != null)
         {
             carDealershipContext.Entry(item).CurrentValues.SetValues(carDealership);
             carDealershipContext.SaveChanges();
         }
     }
 }
 /// <summary>
 /// Change the information about on of the engines
 /// </summary>
 /// <param name="engine">An engine with the new information and the same id as the old one</param>
 public void Update(Engine engine)
 {
     using (engineContext)
     {
         var item = engineContext.Engines.Find(engine.Id);
         if (item != null)
         {
             engineContext.Entry(item).CurrentValues.SetValues(engine);
             engineContext.SaveChanges();
         }
     }
 }
 /// <summary>
 /// Change the information about one of the customers
 /// </summary>
 /// <param name="customer">A customer with the new information and the same id as the old one</param>
 public void Update(Customer customer)
 {
     using (customerContext)
     {
         var item = customerContext.Customers.Find(customer.Id);
         if (item != null)
         {
             customerContext.Entry(item).CurrentValues.SetValues(customer);
             customerContext.SaveChanges();
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Change the information about one of the towns
 /// </summary>
 /// <param name="town">A town with the new information an the same id as the old one</param>
 public void Update(Town town)
 {
     using (townContext)
     {
         var item = townContext.Towns.Find(town.Id);
         if (item != null)
         {
             townContext.Entry(item).CurrentValues.SetValues(town);
             townContext.SaveChanges();
         }
     }
 }
 /// <summary>
 /// Change the information about one of the cars
 /// </summary>
 /// <param name="car">A car with the new information and the same id as the old one</param>
 public void Update(Car car)
 {
     using (carContext)
     {
         var item = carContext.Cars.Find(car.Id);
         if (item != null)
         {
             carContext.Entry(item).CurrentValues.SetValues(car);
             carContext.SaveChanges();
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Change the information about one of the workers
 /// </summary>
 /// <param name="worker">A worker with the new information and the same id as the old one</param>
 public void Update(Worker worker)
 {
     using (workerContext)
     {
         var item = workerContext.Workers.Find(worker.Id);
         if (item != null)
         {
             workerContext.Entry(item).CurrentValues.SetValues(worker);
             workerContext.SaveChanges();
         }
     }
 }