示例#1
0
        public void UpdateProduct(Product product)
        {
            using (var context = new GrovityContext())
            {
                context.Entry(product).State = EntityState.Modified;

                context.SaveChanges();
            }
        }
示例#2
0
        public void UpdateCategory(Category category)
        {
            using (var context = new GrovityContext())
            {
                context.Entry(category).State = EntityState.Modified;

                context.SaveChanges();
            }
        }
示例#3
0
        public void SaveProduct(Product product)
        {
            using (var context = new GrovityContext())
            {
                context.Entry(product.Category).State = EntityState.Unchanged;

                context.Products.Add(product);

                context.SaveChanges();
            }
        }