コード例 #1
0
        public static void Insert(PriceListProduct priceListProduct)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                db.PriceListProducts.Add(priceListProduct);

                db.SaveChanges();
            }
        }
コード例 #2
0
        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();
            }
        }