Exemplo n.º 1
0
        public void Action()
        {
            List <Cashier> cashiers = _cashiersService.Cashiers.ToList();

            for (int i = 0; i < cashiers.Count; i++)
            {
                Cashier cashier = cashiers[i];
                string  cashierRepresentation = $"Cashier No.{i + 1} ({cashier.Worker})";

                if (cashier.Registers.Count == 0)
                {
                    Console.WriteLine($"\n{cashierRepresentation}: No registers yet\n");
                    continue;
                }

                Console.WriteLine($"\n{cashierRepresentation}:");
                foreach ((Customer customer, List <Product> products) in cashier.Registers)
                {
                    Dictionary <string, int> productsByName = ProductUtils.GroupProductsByName(products);
                    Console.WriteLine($"{customer}- {string.Join(",", productsByName)}");
                }
            }
        }