Ejemplo n.º 1
0
        public List <string> GetZips(List <string> fipsCodes, List <string> excludeList, List <string> includeList)
        {
            var zipCodeRepository = new ZipCodeRepository();

            var zipsFound = new List <ZipCode>();

            foreach (var code in fipsCodes)
            {
                //var html = GetWebPage(code);
                //zipsFound.AddRange(GetZipCodesFromHtml(html));

                zipsFound.AddRange(zipCodeRepository.GetZipCodesByFipsCode(code));
            }

            var includedZips = CreateIncludeList(includeList);

            if (includedZips != null)
            {
                zipsFound.RemoveAll(x => !includedZips.Contains(x.ZipCodeId));
            }

            var excludedZips = CreateExcludeList(excludeList);

            if (excludedZips != null)
            {
                zipsFound.RemoveAll(x => excludedZips.Contains(x.ZipCodeId));
            }

            return(zipsFound.Select(x => x.ZipCodeId).ToList());
        }