Example #1
0
 public static void UpdateCustomerData(Customer customerData)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         context.Entry(customerData).State = customerData.ID == 0 ? EntityState.Added : EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #2
0
 public static void UpdateUserData(User updateUsr)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         context.Entry(updateUsr).State = updateUsr.ID == 0 ? EntityState.Added : EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #3
0
 public static void UpdateVehicleData(Vehicle updateVehic)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         context.Entry(updateVehic).State = updateVehic.ID == 0 ? EntityState.Added : EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #4
0
 public static void UpdateMaintenaceData(Maintenace updateMaintanance)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         context.Entry(updateMaintanance).State = updateMaintanance.ID == 0 ? EntityState.Added : EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #5
0
        // public void InsertScheduleData


        public static void CancelSale(InvoiceData selectedItem)
        {
            using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
            {
                Invoice invoice = new Invoice {
                    CancellationReason = selectedItem.CancellationReason,
                    Cancelled          = selectedItem.Cancelled,
                    CancelledBy        = selectedItem.CancelledBy,
                    Date          = selectedItem.Date,
                    CashierID     = selectedItem.CashierID,
                    CustomerID    = selectedItem.CustomerID,
                    ID            = selectedItem.ID,
                    InvoiceNumber = selectedItem.InvoiceNumber
                };
                context.Entry(invoice).State = invoice.ID == 0 ? EntityState.Added : EntityState.Modified;
                context.SaveChanges();
            }
        }