/// <summary> /// Edit a film /// Update by giving old and new film /// </summary> public void EditMovie() { //EDIT HERO List <string> listHero = AppUtils.ConvertStringToList(ListHeroDisplay); foreach (string h in listHero) { if (!ServiceLocator.Current.GetInstance <ManagerJson>().GetHeroes().Any(hero => hero.Id == h)) { ListHeroDisplay = "Invalid ID"; return; } } ISearchableMovie movie = new Film(Id, Title, Affiche, Description, Realisateur, Date, SelectedUniverse, BA, listHero); bool val = ServiceLocator.Current.GetInstance <ManagerJson>().UpdateMovie(movie, CurrentMovie); if (val) { this.ResetDisplayMovie(); this.RefreshList(); } return; }
/// <summary> /// Create a Movie /// </summary> public void CreateMovie() { if (ServiceLocator.Current.GetInstance <ManagerJson>().GetMovies().Any(m => m.GetId() == Id)) { this.Id = "Already Used"; return; } //CREER NOUVEAU HERO List <string> listHero = AppUtils.ConvertStringToList(ListHeroDisplay); foreach (string h in listHero) { if (!ServiceLocator.Current.GetInstance <ManagerJson>().GetHeroes().Any(hero => hero.Id == h)) { this.ListHeroDisplay = "Invalid ID"; return; } } ISearchableMovie movie = new Film(Id, Title, Affiche, Description, Realisateur, Date, SelectedUniverse, BA, listHero); bool val = ServiceLocator.Current.GetInstance <ManagerJson>().AddMovie(movie); if (val) { this.ResetDisplayMovie(); this.RefreshList(); } }