private static void AddReviewConfirmButton_Click(object sender, RoutedEventArgs e) { DataModels database = DataModels.GetInstance(); Button addRoomButton = (Button)sender; List <object> objects = (List <object>)addRoomButton.Tag; Booking booking = (Booking)objects[0]; TextBox reviewTextBox = (TextBox)objects[1]; TextBox ratingTexyBox = (TextBox)objects[2]; if (!BackEndHelper.IsNumber(ratingTexyBox.Text)) { MessageBox.Show("Rating must be a number !"); return; } bool done = database.AddReview(new Review(reviewTextBox.Text, int.Parse(ratingTexyBox.Text), booking.number)); if (done) { MessageBox.Show("Review submitted"); } else { MessageBox.Show("Error!"); } }