//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); }
public void SavePodcastData() { podcastRepository.SaveChanges(); }