public async Task <int> Create(EntityDomainIpAddress entityDomainIpAddress) { using (var context = new InternalDomainCheckerContext(_dbContextOptions)) { context.DomainIpAddresses.Add(entityDomainIpAddress); await context.SaveChangesAsync(); return(entityDomainIpAddress.DomainIpAddressId); } }
public async Task <List <DomainIpAddress> > RetrieveIpAddressOfDomain(Domain domain) { var domainIpAddresses = new List <DomainIpAddress>(); var ipAddresses = _iDataServiceNetwork.RetrieveIpAddress(domain.DomainName); foreach (var ipAddress in ipAddresses) { var entityDomainIpAddress = new EntityDomainIpAddress { DomainId = domain.DomainId, IpAddress = ipAddress.ToString() }; entityDomainIpAddress.DomainIpAddressId = await _iDataServiceDomainIpAddress.Create(entityDomainIpAddress); domainIpAddresses.Add(_iMapper.Map <DomainIpAddress>(entityDomainIpAddress)); } return(domainIpAddresses); }