コード例 #1
0
        public void UpdateCategory(Category category)
        {
            //context.Categories.AddOrUpdate(category);

            _context.Entry(category).State = System.Data.Entity.EntityState.Modified;

            _context.SaveChanges();
        }
コード例 #2
0
        public void UpdateProduct(Product product)
        {
            using (var context = new OMContext())
            {
                //context.Categories.AddOrUpdate(category);

                context.Entry(product).State = EntityState.Modified;

                context.SaveChanges();
            }
        }
コード例 #3
0
        public void ProductSave(Product product)
        {
            using (var context = new OMContext())
            {
                context.Entry(product.Category).State = EntityState.Unchanged;

                context.Products.Add(product);

                context.SaveChanges();
            }
        }
コード例 #4
0
        public bool UpdateOrderStatus(int ID, string status)
        {
            using (var context = new OMContext())
            {
                var order = context.Orders.Find(ID);

                order.Status = status;

                context.Entry(order).State = EntityState.Modified;

                return(context.SaveChanges() > 0);
            }
        }