public static void Insert(PackageProduct packageProduct) { using (var db = OnlineStoreDbContext.Entity) { db.PackageProducts.Add(packageProduct); db.SaveChanges(); } }
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(); } }