示例#1
0
 public ActionResult GetSignaturesByCategoryId(string categoryId)
 {
     var productRepo = new ProductRepo();
     var products = productRepo.GetByCategoryId(categoryId);
     var signatures = products.Select(p => new ProductSignature { Source = p.Source, Number = p.Number, Signature = p.Signature });
     return new Api.Models.JsonResult(signatures);
 }
示例#2
0
        public static Product ParseAndGetByUrl(string url)
        {
            var source    = string.Empty;
            var regSource = new Regex(@"(1mall)|(yihaodian)\.com", RegexOptions.Compiled | RegexOptions.IgnoreCase);

            if (regSource.IsMatch(url))
            {
                source = "yhd";
            }

            var number    = string.Empty;
            var regNumber = new Regex(@"/(\d+)_", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            var m         = regNumber.Match(url);

            if (m.Success)
            {
                number = m.Groups[1].Value;
            }

            var productRepo = new ProductRepo();

            return(productRepo.GetBySourceAndNumber(source, number));
        }
示例#3
0
文件: Product.cs 项目: keily/LightOne
        public static Product ParseAndGetByUrl(string url)
        {
            var source = string.Empty;
            var regSource = new Regex(@"(1mall)|(yihaodian)\.com", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            if (regSource.IsMatch(url))
                source = "yhd";

            var number = string.Empty;
            var regNumber = new Regex(@"/(\d+)_", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            var m = regNumber.Match(url);
            if (m.Success)
                number = m.Groups[1].Value;

            var productRepo = new ProductRepo();
            return productRepo.GetBySourceAndNumber(source, number);
        }