private void buttonSaveChanges_Click(object sender, EventArgs e) { // 1. Get details int muscleGroupId = Convert.ToInt32(textBoxId.Text); string muscleGroupName = textBoxEditName.Text; // 2. Create object MuscleGroup muscleGroup = new MuscleGroup(muscleGroupId, muscleGroupName); // 3. Convert to JSON var jsonData = JsonConvert.SerializeObject(muscleGroup); // 4. Create request, send it, and get response APIRequests request = new APIRequests(); string url = $"{request.allMuscleGroupsEndpoint}/{muscleGroupId}/{muscleGroupName}"; var response = request.SendPathRequestData(url); // 5. Handle response if (response.Contains("Successfully")) { MessageBox.Show("Successfully modified the muscle group"); textBoxEditName.Text = ""; ResetMuscleGroupView(); } else { MessageBox.Show("Something went wrong, and we couldn't edit the muscle group"); } }