Exemplo n.º 1
0
        public static async Task CreateStandardParametres(bool clearAll = false)
        {
            var ph = Kernel.Get<IParametreBusinessHelper<Parametre>>();
            var pps = new PParametresInitializer().StandardPParametres();
            var ps = new ParametresInitializer().StandardParametres();
            if (clearAll)
                await ph.DeleteAll();
            await ps.ForEachAsync(async p =>
            {
                await ph.Create(pps.Where(x => x.Id == p.id).FirstOrDefault(), p.value);

            });

            await ph.Save();
        }
Exemplo n.º 2
0
        public static async Task CreateStandardPParametres(bool clearAll = false)
        {
            IRepository<PParametre> repo = Kernel.Get<IRepository<PParametre>>();
            var ps = new PParametresInitializer().StandardPParametres();
            Task t = Task.Factory.StartNew(async () =>
            {
                if (clearAll) await repo.DeleteAll();

                await ps.ForEachAsync(p => repo.Upsert(p));

            });

            await t;

        }