コード例 #1
0
        public static void Insert(ProductVarient productVarient)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                db.ProductVarients.Add(productVarient);

                db.SaveChanges();
            }
        }
コード例 #2
0
        public static void Update(ProductVarient productVarient)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                var orgProductVarient = db.ProductVarients.Where(item => item.ID == productVarient.ID).Single();

                orgProductVarient.ProductID  = productVarient.ProductID;
                orgProductVarient.Title      = productVarient.Title;
                orgProductVarient.PriceCode  = productVarient.PriceCode;
                orgProductVarient.IsEnabled  = productVarient.IsEnabled;
                orgProductVarient.LastUpdate = productVarient.LastUpdate;

                db.SaveChanges();
            }
        }