private static IEnumerable<Order> GetLastPaidOrders(Ticket ticket)
 {
     IEnumerable<PaidItem> paidItems = ticket.GetPaidItems().ToList();
     var result = paidItems.Select(x => ticket.Orders.First(y => y.MenuItemId + "_" + y.Price == x.Key)).ToList();
     foreach (var order in result)
     {
         order.Quantity = paidItems.First(x => x.Key == order.MenuItemId + "_" + order.Price).Quantity;
     }
     return result;
 }
Example #2
0
 private static IEnumerable<TicketItem> GetLastPaidItems(Ticket ticket)
 {
     var result = ticket.GetPaidItems().Select(x => ticket.TicketItems.First(y => y.MenuItemId == x)).ToList();
     result = result.Select(ObjectCloner.Clone).ToList();
     foreach (var ticketItem in result)
     {
         ticketItem.Quantity = ticket.GetPaidItemQuantity(ticketItem.MenuItemId);
     }
     return result;
 }