public void OnGet(int guest, string warning) { Orders = _events .IncludeOnly(@event => @event switch { OrderPlaced order => order.Guest == guest, DeliveryReceived delivery => delivery.Guest == guest, BillPaid paid => paid.Guest == guest, _ => false }
private static ImmutableDictionary <int, OrderViewModel> MarkAsDelivered(ImmutableDictionary <int, OrderViewModel> state, DeliveryReceived delivery) { if (state.TryGetValue(delivery.Order, out var model)) { var deliveryMark = new OrderViewModel.OrderItem.Delivery { DeliveredOn = delivery.On, DeliveryId = delivery.Delivery }; MarkUndeliveredItem(model.FoodOrder, delivery.Items.Food, deliveryMark); MarkUndeliveredItem(model.DrinkOrder, delivery.Items.Drinks, deliveryMark); } return(state); }