Ejemplo n.º 1
0
        private void btnUpdateCategory_Click(object sender, EventArgs e)
        {
            if (Validator.CheckCategoryIsNotEmpty(txtCategory) && Validator.CheckIfCategoryItemSelected(lbxCategories))
            {
                try
                {
                    string currentName = lbxCategories.SelectedItem.ToString();
                    string newName     = txtCategory.Text;

                    podcastController.UpdatePodcastCategory(currentName, newName);
                    categoryController.UpdateCategoryName(currentName, newName);

                    FillPodcastList();
                    FillCategoryList();
                    FillCategoryComboBox();
                    txtCategory.Text = string.Empty;
                    MessageBox.Show("Category updated!");
                }
                catch (Exception)
                {
                    Console.WriteLine("Out of bounds for categories!");
                }
            }
        }