Beispiel #1
0
        public void Apply(MenuItemsRejected @event)
        {
            RejectedItemsValue += @event.MenuItems.Sum(i => i.Price);
            RejectedMenuItems.AddRange(@event.MenuItems.Select(i => new MenuItemView(i)));

            foreach (var rejectedItem in @event.MenuItems)
            {
                // Prioritize the oustanding over the served ones when removing items
                var outstanding = OutstandingMenuItems
                                  .FirstOrDefault(b => b.Number == rejectedItem.Number);

                // TODO: Fix fugly implementation
                if (outstanding != null)
                {
                    OutstandingMenuItems.Remove(outstanding);
                }
                else
                {
                    var served = ServedMenuItems
                                 .FirstOrDefault(b => b.Number == rejectedItem.Number);

                    if (served != null)
                    {
                        ServedMenuItems.Remove(served);
                    }
                }
            }
        }
Beispiel #2
0
        public void Apply(MenuItemsRejected @event)
        {
            foreach (var rejectedItem in @event.MenuItems)
            {
                // Prioritize the oustanding over the served ones when removing items
                var outstanding = OutstandingMenuItems
                                  .FirstOrDefault(b => b.Number == rejectedItem.Number);

                // TODO: Fix fugly implementation
                if (outstanding != null)
                {
                    OutstandingMenuItems.Remove(outstanding);
                }
                else
                {
                    var served = ServedMenuItems
                                 .FirstOrDefault(b => b.Number == rejectedItem.Number);

                    if (served != null)
                    {
                        ServedMenuItems.Remove(served);
                    }
                }
            }
        }
Beispiel #3
0
        public void Apply(MenuItemsServed @event)
        {
            ServedMenuItems.AddRange(@event.MenuItems.Select(i => new MenuItemView(i)));
            ServedItemsValue += @event.MenuItems.Sum(i => i.Price);

            foreach (var servedItem in @event.MenuItems)
            {
                var outstanding = OutstandingMenuItems
                                  .FirstOrDefault(b => b.Number == servedItem.Number);

                if (outstanding != null)
                {
                    OutstandingMenuItems.Remove(outstanding);
                }
            }
        }