public void SaveMainList() { if (AllowUpdate != true) { MessageBox.Show(strings.AllowAddMsg); return; } foreach (var row in MainRowList) { if (row != null) { var valiationCollection = new List <ValidationResult>(); var isvalid = Validator.TryValidateObject(row, new ValidationContext(row, null, null), valiationCollection, true); if (isvalid && !Loading) //&& !SelectedMainRow.LockedRow) { var save = row.Iserial == 0; var saveRow = new TblSeasonalMasterList(); saveRow.InjectFrom(row); saveRow.TblSeasonalMasterListDetails = row.SeasonalMasterListDetail; if (row == MainRowList.LastOrDefault()) { Loading = true; } Client.UpdateOrInsertTblSmlAsync(saveRow, save, MainRowList.IndexOf(row)); } } } }