示例#1
0
        public IList <Domain> GetDomains(long[] ids = null)
        {
            var domainQuery = Domains.AsQueryable();

            if (ids != null)
            {
                domainQuery = domainQuery.Where(x => ids.Contains(x.DomainId));
            }
            var domains = domainQuery
                          .ToList();

            if (!domains.IsNullOrEmpty())
            {
                var domainScans = DomainScansQuery()
                                  .ToList()
                                  .Where(x => x.LatestDomainScan != null)
                                  .ToDictionary(x => x.LatestDomainScan.DomainId, x => x);
                foreach (var domain in domains)
                {
                    if (domainScans.ContainsKey(domain.DomainId))
                    {
                        domain.LatestDomainScan      = domainScans[domain.DomainId].LatestDomainScan;
                        domain.LatestValidDomainScan = domainScans[domain.DomainId].LatestValidDomainScan;
                    }
                }
            }

            return(domains);
        }