private void AcceptInput(object sender, RoutedEventArgs e) { if (!inputCorrect) { MessageBox.Show("Description field can't be empty.", "Invalid description input", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { // create new tool instance ToolModel updateTool = new ToolModel(); if (SqliteDataAcces.SearchDataByText("ToolID", "Tools", "ToolID", toolID).ToList().Count == 0) { MessageBox.Show("Tool not found in database.", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { // Assign info to updateTool updateTool.ToolID = Convert.ToInt32(toolID); updateTool.Storage = StorageTextBox.Text; updateTool.Location = LocationTextBox.Text; updateTool.Description = DescriptionTextBox.Text; updateTool.HolderVendor = HolderVendorComboBox.Text; updateTool.HolderArt = HolderArtTextBox.Text; updateTool.ExtensionVendor = ExtensionVendorComboBox.Text; updateTool.ExtensionArt = ExtensionArtTextBox.Text; updateTool.ToolVendor = ToolVendorComboBox.Text; updateTool.ToolArt = ToolArtTextBox.Text; // Write new tool to Database and check if succesfull bool writingSuccesFull = SqliteDataAcces.UpdateToolRecord(updateTool); if (writingSuccesFull) { MessageBox.Show($"Changes succesfully written to database.", "Succesfull", MessageBoxButton.OK, MessageBoxImage.Information); //Close window raiseClosingEvent = false; Close(); //Refresh data grid ((MainWindow)Owner).SetDataGrid(); } else { MessageBox.Show($"Failed update tool!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } }