Exemplo n.º 1
0
        private void OrderCreatorViewModelOnCardSaved(object sender, Order newOrder)
        {
            if (Orders.Any(o => o.Order.Id == newOrder.Id))
            {
                var oldListItem = Orders.FirstOrDefault(order => order.Order.Id == newOrder.Id);
                oldListItem.Order = newOrder;
            }
            else
            {
                DataBaseService.AddOrder(newOrder);
            }
            var DataBaseOrder = DataBaseService.GetAllOrders();

            Orders.Clear();
            foreach (var order in DataBaseOrder)
            {
                Orders.Add(new OrderListItem(order));
            }
        }