示例#1
0
        public static void Insert(PackageProduct packageProduct)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                db.PackageProducts.Add(packageProduct);

                db.SaveChanges();
            }
        }
示例#2
0
        public static void Update(PackageProduct packageProduct)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                var orgPackageProduct = db.PackageProducts.Where(item => item.ID == packageProduct.ID).Single();

                orgPackageProduct.ProductID        = packageProduct.ProductID;
                orgPackageProduct.ProductVarientID = packageProduct.ProductVarientID;
                orgPackageProduct.OldPrice         = packageProduct.OldPrice;
                orgPackageProduct.NewPrice         = packageProduct.NewPrice;
                orgPackageProduct.LastUpdate       = packageProduct.LastUpdate;

                db.SaveChanges();
            }
        }