public ActionResult Create(Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                if (Request.IsAjaxRequest())
                    return Content(null);
                return RedirectToAction("Index");
            }

            ViewBag.CompanyId = new SelectList(db.Companies, "Id", "Name", product.CompanyId);
            if (Request.IsAjaxRequest())
                return PartialView(product);
            return View(product);
        }
        List <object> get_ProductLink_objects(Cliver.ProductIdentifier.ProductLink pl, int index, double score_factor)
        {
            if (pl == null)
            {
                return(null);
            }

            List <object> ds = new List <object>();

            foreach (Cliver.ProductIdentifier.Product product in pl.Product2s)
            {
                Cliver.Fhr.ProductOffice.Models.Product p = product.DbProduct;

                object d = new
                {
                    Id         = p.Id,
                    CompanyId  = p.CompanyId,
                    ExternalId = p.ExternalId,
                    CreateTime = p.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    ModifyTime = p.ModifyTime != null ? ((DateTime)p.ModifyTime).ToString("yyyy-MM-dd HH:mm:ss") : null,
                    UpdateTime = p.UpdateTime != null ? ((DateTime)p.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss") : null,
                    Name       = p.Name,
                    Url        = p.Url,
                    ImageUrls  = p.ImageUrls != null?p.ImageUrls.Split('\n') : new string[]
                    {
                    },
                    Sku         = p.Sku,
                    Category    = p.Category,
                    Description = p.Description,
                    LinkId      = p.LinkId != null ? p.LinkId : -p.Id,
                    Source      = p.Source,
                    Stock       = p.Stock,
                    CompanyName = p.Company.Name,
                    Price       = (from r in p.Prices orderby r.Time descending select(string) r.Currency.Symbol + r.Value.ToString()).FirstOrDefault(),
                    //_MatchedWords = (from x in pl.Product1s select new { x.DbProduct.Id, pl.Get(x.DbProduct.Id, p.Id).MatchedWords }).ToDictionary(x => x.Id, x => x.MatchedWords),
                    _Index         = index,
                    _Score         = (!double.IsNaN(pl.Score) ? pl.Score : 1) * score_factor,
                    _CategoryScore = (!double.IsNaN(pl.CategoryScore) ? pl.CategoryScore : 1) * score_factor,
                    _NameScore     = (!double.IsNaN(pl.NameScore) ? pl.NameScore : 1) * score_factor,
                    //_SecondaryScore = (!double.IsNaN(pl.SecondaryScore) ? pl.SecondaryScore : 1) * score_factor,
                };
                d = Cliver.PrepareField.Html.GetDbObject(d);
                ds.Add(d);
            }
            return(ds);
        }