Esempio n. 1
0
 public void addEmployee(Employee emp)
 {
     using (GSQ2_Garry_TestContext ctx = new GSQ2_Garry_TestContext())
     {
         ctx.Employee.Add(emp);
         ctx.SaveChanges();
     }
 }
Esempio n. 2
0
 public void addNewCarNewModel(Car car)
 {
     using (GSQ2_Garry_TestContext ctx = new GSQ2_Garry_TestContext())
     {
         ctx.Car.Add(car);
         // ctx.Entry(car.CarFeatures.)
         ctx.SaveChanges();
     }
 }
Esempio n. 3
0
 public void updateEmployee(Employee emp)
 {
     using (GSQ2_Garry_TestContext ctx = new GSQ2_Garry_TestContext())
     {
         ctx.Entry(emp).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
         ctx.Entry(emp.EmployeeNavigation).State =
             Microsoft.EntityFrameworkCore.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Esempio n. 4
0
 public void sellCar(Car car, Customer cust, decimal totalPrice, string notes)
 {
     using (GSQ2_Garry_TestContext ctx = new GSQ2_Garry_TestContext())
     {
         CarSaleRecord sale = new CarSaleRecord();
         sale.Customer             = cust;
         sale.Car                  = car;
         sale.PuchaseDate          = DateTime.Now;
         sale.TotalPaidPrice       = totalPrice;
         sale.Note                 = notes;
         ctx.Entry(sale.Car).State = EntityState.Unchanged;
         ctx.CarSaleRecord.Add(sale);
         ctx.SaveChanges();
     }
 }