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); }
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)); }
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); }