예제 #1
0
 public void Update(Order order)
 {
     using (var db = new OrderDB())
     {
         db.Order.Attach(order);
         db.Entry(order).State = EntityState.Modified;
         order.Items.ForEach(
             item => db.Entry(item).State = EntityState.Modified);
         db.SaveChanges();
     }
 }
예제 #2
0
 public bool addOrder(Order order)
 {
     try
     {
         context.Entry(order).State = EntityState.Added;
         context.SaveChanges();
         return(true);
     }
     catch (DbUpdateException e)
     {
         return(false);
     }
 }
예제 #3
0
 private void toolBar_btnEdit_Click(object sender)
 {
     if (production_orderDataGrid.SelectedItem != null)
     {
         production_order production_order = (production_order)production_orderDataGrid.SelectedItem;
         production_order.IsSelected           = true;
         production_order.State                = EntityState.Modified;
         OrderDB.Entry(production_order).State = EntityState.Modified;
     }
     else
     {
         toolBar.msgWarning("Please Select an Item");
     }
 }
예제 #4
0
        public ActionResult <OrderItem> Put(String id, OrderItem item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

            db.Entry(item).State = EntityState.Modified;
            db.SaveChanges();
            return(NoContent());
        }