public static void Insert(PriceListProduct priceListProduct) { using (var db = OnlineStoreDbContext.Entity) { db.PriceListProducts.Add(priceListProduct); db.SaveChanges(); } }
public static void Update(PriceListProduct priceListProduct) { using (var db = OnlineStoreDbContext.Entity) { var orgPriceListProduct = db.PriceListProducts.Where(item => item.ID == priceListProduct.ID).Single(); orgPriceListProduct.Title = priceListProduct.Title; orgPriceListProduct.SubTitle = priceListProduct.SubTitle; orgPriceListProduct.ProductID = priceListProduct.ProductID; orgPriceListProduct.Price = priceListProduct.Price; orgPriceListProduct.Guarantee = priceListProduct.Guarantee; orgPriceListProduct.IsAvailable = priceListProduct.IsAvailable; orgPriceListProduct.OrderID = priceListProduct.OrderID; orgPriceListProduct.PriceListProductType = priceListProduct.PriceListProductType; orgPriceListProduct.LastUpdate = priceListProduct.LastUpdate; db.SaveChanges(); } }