private int DeleteTblStandardBOM(TblStandardBOM row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblStandardBOMs where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
internal void SaveBom() { if (AllowUpdate != true) { MessageBox.Show(strings.AllowAddMsg); return; } var valiationCollection = new List <ValidationResult>(); var isvalid = Validator.TryValidateObject(SelectedBomRow, new ValidationContext(SelectedBomRow, null, null), valiationCollection, true); if (isvalid) { var bomListToSave = new ObservableCollection <TblStandardBOM>(); foreach (var row in SelectedMainRow.BomList) { var newrow = new TblStandardBOM(); newrow.InjectFrom(row); bomListToSave.Add(newrow); } Client.UpdateOrInsertTblStandardBOMAsync(bomListToSave); } }