コード例 #1
0
        public List <HSCodeDescription> GetHSCodes(string serachTerm, int countryId)
        {
            List <HSCodeDescription> data = new List <HSCodeDescription>();

            if (CommonConversion.ConvertToInt(serachTerm) > 0)
            {
                data = dbContext.HSCodes.Where(p => p.HSCode1.Contains(serachTerm) && p.CountryId == countryId)
                       .Select(p => new HSCodeDescription {
                    HSCode = p.HSCode1, Description = p.Description, HsCodeId = p.HSCodeId
                })
                       .ToList();
            }
            else if (serachTerm != "^[0-9]+$")
            {
                data = dbContext.HSCodes.Where(p => p.Description.Contains(serachTerm) && p.CountryId == countryId)
                       .Select(p => new HSCodeDescription {
                    HSCode = p.HSCode1, Description = p.Description, HsCodeId = p.HSCodeId
                })
                       .ToList();
            }


            return(data);
        }