Пример #1
0
        public async Task InsertOrUpdateSecurityGroups(IEnumerable <CNDSSecurityGroupDTO> dtos)
        {
            Guid networkID = await CNDSEntityUpdater.GetNetworkID(DataContext);

            try
            {
                using (var cnds = new CNDSEntityUpdater(networkID))
                {
                    await CNDSEntityUpdater.CreateSecurityGroups(dtos.Where(x => x.ID == null || x.ID == Guid.Empty));

                    await CNDSEntityUpdater.UpdateSecurityGroups(dtos.Where(x => x.ID != null || x.ID != Guid.Empty));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                throw;
            }
        }