Пример #1
0
        private async Task AddOrgUnits(List <OrgUnitAddedMsg> adds)
        {
            var orgUnits = this._mapper.Map <IList <Department> >(adds.Select(u => u.NewData));
            var positons = orgUnits.SelectMany(u => u.Positions).ToList();

            using (var db = new ServiceDbContext(_dbOptions))
            {
                await db.BulkInsertOrUpdateAsync(orgUnits);

                await db.BulkInsertOrUpdateAsync(positons);
            }
        }