Beispiel #1
0
        public void RemoveOrder(Order order)
        {
            List <Order> orders = GetOrdersByDate(order.Date).ToList();

            if (orders.RemoveAll(o => o.OrderNum == order.OrderNum) != 1)
            {
                throw new InvalidOperationException();
            }
            OrderMapper.WriteAllToDate(order.Date, orders);
        }
Beispiel #2
0
        public void SaveOrder(Order order)
        {
            List <Order> orders = GetOrdersByDate(order.Date).ToList();

            if (!orders.Exists(o => o.OrderNum == order.OrderNum))
            {
                orders.Add(order);
            }
            else
            {
                int index = orders.FindIndex(o => o.OrderNum == order.OrderNum);
                orders[index] = order;
            }
            OrderMapper.WriteAllToDate(order.Date, orders);
        }