Example #1
0
        public string GetPodcastUrl(int index)
        {
            var     podcastList = podcastRepository.GetAll();
            Podcast podcast     = podcastList[index];
            string  url         = podcast.Url;

            return(url);
        }
Example #2
0
        //Updates a category object
        public void UpdateCategoryObject(int index, string oldCategory, Category updateCategory)
        {
            if (updateCategory == null)
            {
                updateCategory = new Category(updateCategory.Name);
            }
            categoryRepository.Update(index, updateCategory);
            PodcastRepository podRepo = new PodcastRepository();
            var podList = podRepo.GetAll();

            //Loops through all saved podcasts
            foreach (var item in podList)
            {
                if (item.Category.Equals(oldCategory))
                {
                    //If the objects Category property is the same as the oldCategory parameter the new category is set
                    item.Category = updateCategory.Name;
                }
            }
            podRepo.SaveChanges(podList);
        }
Example #3
0
        //Returns true if the parameter is not already in the Podcasts file
        public bool PodcastIsUnique(string url)
        {
            bool isValid = true;

            try
            {
                List <Podcast> list = podRepo.GetAll();
                foreach (var item in list)
                {
                    string link = item.Url;

                    if (link.Equals(url))
                    {
                        isValid = false;
                        throw new PodcastAlreadyExistsException();
                    }
                }
            }
            catch (PodcastAlreadyExistsException)
            {
            }
            return(isValid);
        }
Example #4
0
 public PodcastController()
 {
     podcastRepository = new PodcastRepository();
     podcastList       = podcastRepository.GetAll();
 }
 public List <Podcast> RetrieveAllPodcasts()
 {
     return(podcastRepository.GetAll());
 }