private void OkButtonNewRestaurant_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(NewRestaurantTextBox.Text)) { MessageBox.Show("The restaurant must have a name!"); } else { var restaurantToAdd = new Restaurant() { Name = NewRestaurantTextBox.Text, KitchenModel = _kitchenRepository.GetKitchenModel(KitchenModelComboBox.SelectedIndex + 1) // KitchenModel = _restaurantRepository.GetKitchenModel(KitchenModelComboBox.SelectedIndex + 1) }; _restaurantRepository.AddRestaurant(restaurantToAdd); Close(); } }