private void EditRecord(object isEditRow) { if (SelectedEditedRecords.Count > 0) { SelectedEditedRecords.Clear(); } SelectedEditedRecords.Add(selectedRecord); }
private void SaveRecord(object obj) { //Checking if the SelectedItem of the ListBox is null or not. If null, then we are adding new rows. else updating the selected item. if (SelectedItem == null) { foreach (var item in editedRecords) { records.Add(item); } MessageBox_Show(null, $"Successfully added a new record"); } var fileName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AssignmentApp.json"; readWriteJsonFile.WriteJson(fileName, records); SelectedEditedRecords.Clear(); CanUserAddRecord = false; MessageBox_Show(null, $"File is successfully saved at location : {fileName}", "File Save", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information); }
private void AddNewRecord(object obj) { CanUserAddRecord = true; SelectedEditedRecords.Clear(); }