public void Update(SoSanhGia ss)
 {
     SoSanhGia ssg = db.SoSanhGias.Where(x => x.MaSP == ss.MaSP && x.MaWebsite == ss.MaWebsite).FirstOrDefault();
     if (ssg != null)
     {
         ssg.Gia = ss.Gia;
         db.Entry(ssg).State = System.Data.EntityState.Modified;
         db.SaveChanges();
     }
     else
     {
         Insert(ss);
     }
 }
        public void Update()
        {
            int offset = 0;
            int count = 10;
            List<SanPham> listProduct = pdata.GetProducts(offset, count);
            List<Website> listWebsite = wdata.GetListWebsite();
            while (listProduct.Count > 0)
            {
                foreach (SanPham sp in listProduct)
                {
                    foreach (Website web in listWebsite)
                    {
                        SoSanhGia ss = new SoSanhGia();
                        ss.MaSP = sp.MaSP;
                        ss.MaWebsite = web.MaSo;
                        ss.Gia = GetPrice(web, sp.TenSP.Trim());
                        prdata.Update(ss);
                    }
                }

                offset += count;
                listProduct = pdata.GetProducts(offset, count);
            }
        }
 public void Insert(SoSanhGia ss)
 {
     db.SoSanhGias.Add(ss);
     db.SaveChanges();
 }