| 12345678910111213141516171819202122232425262728293031323334 |
- using CD67.FicheCollege.Entity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.Entity;
- namespace CD67.FicheCollege.Factory
- {
- public partial class AnneeFactory : Internal.BaseFactory<Entity.Annee>
- {
- public AnneeFactory(Entities dbContext) : base(dbContext) { }
- public Annee getByLibelle(params object[] keyValues)
- {
- string libelle = keyValues[0].ToString();
-
- Annee annee = base.getAll().Where(a=>a.Libelle == libelle).First();
- //si l'élément n'existe pas, on le créé
- if (annee == null)
- {
- annee = new Annee()
- {
- Libelle = libelle
- };
- this.add(ref annee);
- dbContext.Entry(annee).Reference(i => i.Colleges).Load();
- }
- return annee;
- }
- }
- }
|