public static void Persist(Prestation prestation, int poleId, Dictionary <string, bool> territoires) { prestation.Pole = DAO.Find <Pole>(poleId); DAO.Persist(prestation); IEnumerable <Territoire> territoireSet = IsJoinedDictionary.ToDbSet <Territoire>(territoires); territoireSet.Each(t => PrestationTerritoireDAO.Join(prestation, t)); }
public static Prestation_Territoire Join(Prestation prestation, Territoire territoire) { var join = new Prestation_Territoire() { Prestation = prestation, Territoire = territoire }; DAO.Persist(join); return(join); }
public static Prestation_Territoire Join(int prestationId, int territoireId) { var join = new Prestation_Territoire() { Prestation = DAO.db.Prestations.Find(prestationId), Territoire = DAO.db.Territoires.Find(territoireId) }; DAO.Persist(join); return(join); }
public static void AddActivite(int prestationId, int territoireId, Activite activite) { Func <Prestation_Territoire> joinIfNull = () => Join(prestationId, territoireId); var pt = Where(prestationId, territoireId, joinIfNull); var activites = pt.Activites ?? new List <Activite>(); activites.Add(activite); DAO.Persist(activite); DAO.Update(pt); }