コード例 #1
0
ファイル: PodcastController.cs プロジェクト: pandrum/Podify
        public string GetPodcastUrl(int index)
        {
            var     podcastList = podcastRepository.GetAll();
            Podcast podcast     = podcastList[index];
            string  url         = podcast.Url;

            return(url);
        }
コード例 #2
0
ファイル: CategoryController.cs プロジェクト: NoLevL/PODCAST
        //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);
        }
コード例 #3
0
ファイル: Validation.cs プロジェクト: NoLevL/PODCAST
        //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);
        }
コード例 #4
0
ファイル: PodcastController.cs プロジェクト: pandrum/Podify
 public PodcastController()
 {
     podcastRepository = new PodcastRepository();
     podcastList       = podcastRepository.GetAll();
 }
コード例 #5
0
 public List <Podcast> RetrieveAllPodcasts()
 {
     return(podcastRepository.GetAll());
 }