private void bwSave_DoWork(object sender, DoWorkEventArgs e) { if (insertOrUpdate == true) { OffDayController.Insert(offDay); offDayCurrentList.Add(offDay); foreach (var supp in supplierCurrentList) { var offDayMapInsert = new OffDay_Supplier_Mapping() { SupplierID = supp.SupplierID, OffDayID = offDay.OffDayID }; OffDayMapController.Insert(offDayMapInsert); } } if (insertOrUpdate == false) { // Update OffDay OffDayController.Update(offDayCurrent); // Delete OffDayMap RemoveOffDayMap(offDayCurrent.OffDayID); // Insert OffDayMap foreach (var supp in supplierCurrentList) { var offDayMapInsert = new OffDay_Supplier_Mapping() { SupplierID = supp.SupplierID, OffDayID = offDayCurrent.OffDayID }; OffDayMapController.Insert(offDayMapInsert); } } }
private void bwInsert_DoWork(object sender, DoWorkEventArgs e) { OffDayController.Insert(offDayToInsert); }