Beispiel #1
0
        private static void ReteriveOrdersAndEditUsingDisconnectedEntityOverWire()
        {
            OrderClient orderservice = new OrderClient();

            Order order = orderservice.GetOrderDetailsByKey(6);

            // Order Edit
            order.Comment = "Comment2";
            order.State   = State.Modified;

            // Line Item Edit
            order.LineItems.Where(i => i.LineItemId == 1).FirstOrDefault().OrderQty = 900;
            order.LineItems.Where(i => i.LineItemId == 1).FirstOrDefault().State    = State.Modified;

            //Line Item Delete
            order.LineItems.Where(i => i.LineItemId == 4).FirstOrDefault().State = State.Deleted;

            //New Line Item Added
            var orderlineitem = new LineItem
            {
                OrderQty  = 999,
                ProductId = 1,
                Order     = order,
                UnitPrice = 5000,
                State     = State.Added
            };

            order.LineItems.Add(orderlineitem);
            orderservice.AddUpdateOrders(order);
        }