public static void Insert(ProductPrice productPrice) { using (var db = OnlineStoreDbContext.Entity) { db.ProductPrices.Add(productPrice); db.SaveChanges(); } }
public static void Update(ProductPrice productPrice) { using (var db = OnlineStoreDbContext.Entity) { var orgProductPrice = db.ProductPrices.Where(item => item.ID == productPrice.ID).Single(); orgProductPrice.ProductID = productPrice.ProductID; orgProductPrice.Price = productPrice.Price; orgProductPrice.PriceType = productPrice.PriceType; orgProductPrice.Description = productPrice.Description; orgProductPrice.LastUpdate = productPrice.LastUpdate; db.SaveChanges(); } }