예제 #1
0
파일: Form1.cs 프로젝트: pandrum/Podify
        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!");
                }
            }
        }