public contratControl() { this.DataContext = this; InitializeComponent(); App.dbContext.Type_Contrat.ToList().ForEach( c => Contrats.Add(c) ); }
/// <summary> /// Add a new contract /// </summary> /// <param name="contrat"></param> /// <exception cref="Exception">Error Contract Existing</exception> /// <exception cref="ArgumentNullException">Contract is Null</exception> public void AddContrat(Contrat contrat) { if (contrat != null) { if (!HasContratActif()) { Contrats.Add(contrat); } else { throw new Exception("Un contrat est déja actif \n Impossible d'ajouter un nouveau contrat."); } } }