public void RetirerProgramme(Programme prg) { if (this.ContientProgramme(prg)) { this.ListeProgrammes.Remove(prg); } }
public void MiseAJourProgramme(Programme prg, Programme newPrg) { Programme majPrg = this.RecupererProgramme(prg); majPrg.Intitule = newPrg.Intitule; majPrg.DureeMax = newPrg.DureeMax; }
// Méthodes de gestion de la liste des programmes public bool ContientProgramme(Programme prg) { if (this.ListeProgrammes != null) { if (this.RecupererProgramme(prg) != null) { return(true); } } return(false); } // TODO : vérifier la pertinence de la vérification systématique.
} // TODO : vérifier la pertinence de la vérification systématique. public void AjouterProgramme(Programme prg) { if (this.ListeProgrammes == null) { this.ListeProgrammes = new ObservableCollection <Programme>(); } if (this.ContientProgramme(prg)) { // TODO : Exception throw new ListePrincipaleException("Le programme existe déjà"); } else { this.Message = "Le programme va être ajouté"; this.ListeProgrammes.Add(prg); } }
public Programme RecupererProgramme(Programme prg) { return(this.ListeProgrammes.FirstOrDefault(p => p.ComparerId(prg))); }