Beispiel #1
0
    public static bool validateSelectedCategory(string category, string modifier)
    {
        switch (modifier)
        {
        case "remove":
            string podcasts = "";
            if (PodcastHandler.lookupTrue(category, "podcast"))
            {
                foreach (var podcast in PodcastHandler.getPodcasts(category))
                {
                    podcasts = podcast.Title + ", " + podcasts;
                }
                MessageBox.Show("Följande podcasts tillhör " + category + " kategorin: \n" + podcasts + " \n ändra kategori för podcastsen för att ta bort kategorin");
                break;
            }
            MessageBox.Show("Kategori borttagen");
            return(true);

        case "add":
            if (PodcastHandler.lookupTrue(category, "category"))
            {
                MessageBox.Show("Kategorin finns redan i listan");
                break;
            }
            return(true);

        case "edit":
            if (PodcastHandler.lookupTrue(category, "podcast"))
            {
                MessageBox.Show("Podcasts tillhör den valda kategorin, vänligen ändra kategori för dessa podcasts för att ändra");
                break;
            }
            return(true);
        }
        return(false);
    }