コード例 #1
0
        // method for updating a product
        public int Product_Update(Product prod)
        {
            using (var context = new HTPSContext())
            {
                context.Entry(prod).State = System.Data.Entity.EntityState.Modified;

                return(context.SaveChanges());
            }
        }
コード例 #2
0
        public int Product_Delete(Product prod)
        {
            using (var context = new HTPSContext())
            {
                prod.Discontinued         = true;
                prod.DiscontinuedDate     = DateTime.Today;
                context.Entry(prod).State = System.Data.Entity.EntityState.Modified;

                return(context.SaveChanges());
            }
        }