public void StartService()
        {
            // List of commands
            while (true)
            {
                try
                {
                    displayMessage.WriteMessage("\n\n*********************");
                    displayMessage.WriteMessage(" Type your desried option:");
                    displayMessage.WriteMessage("*********************");
                    displayMessage.WriteMessage("Insert - If you like to enter money in cash slot");
                    displayMessage.WriteMessage("Order - To order coke, sprite, fanta using buttons");
                    displayMessage.WriteMessage("SMS order - To order through SMS");
                    displayMessage.WriteMessage("Recall - To get your remaining balance");
                    displayMessage.WriteMessage("\n-----------------");
                    displayMessage.WriteMessage("Your credit: " + money);
                    displayMessage.WriteMessage("-----------------\n\n");

                    string input = Console.ReadLine();

                    if (input != null)
                    {
                        input = input.ToLower();

                        // inserts money

                        inventoryCollection = inventory.GetInventory();

                        if (input.StartsWith("insert"))
                        {
                            //Add to credit
                            //
                            money = insertCredit.InsertCash(input, money);
                        }
                        else if (input.StartsWith("order")) // ordering from buttons
                        {
                            buttonOrder.OrderByButton(input, inventoryCollection, ref money);
                        }
                        // sms ordering
                        else if (input.StartsWith("sms order"))
                        {
                            smsOrder.OrderBySms(input, inventoryCollection);
                        }
                        else if (input.Equals("recall"))
                        {
                            returnCash.ReturnRemainingCredit(money);
                        }
                    }
                }
                catch (Exception ex)
                {
                    // Log exception in DB
                    Console.WriteLine("Oops! Something went wrong, Try again!", ex.Message);
                }
            }
        }
 public void OrderByButton(string input, List <Soda> inventory, ref int money)
 {
     if (!Enum.TryParse(input.Split(' ')[1], true, out Products product))
     {
         //Console.WriteLine("\n> No Soda found");
         displayMessage.WriteMessage("\n> No Soda found");
     }
     else
     {
         CalculateSoda(inventory, ref money, product);
     }
 }
        public int InsertCash(string input, int money)
        {
            // input validation
            if (!int.TryParse(input.Split(' ')[1], out int cash))
            {
                displayMessage.WriteMessage("\n> Invalid Input, Try again!");
                return(money);
            }

            money += cash;
            displayMessage.WriteMessage($"\n> Adding {cash} to credit");
            return(money);
        }
        public void OrderBySms(string input, List <Soda> inventory)
        {
            //Note: logically it should subtract price as in OrderByButton
            // but I don't find any description either it this function should do the same or not

            if (input == null || !Enum.TryParse(input.Split(' ')[2], true, out Products product))
            {
                displayMessage.WriteMessage("\n> No such soda");
            }
            else
            {
                ReturnSoda(inventory, product);
            }
        }
 public void ReturnRemainingCredit(int money)
 {
     displayMessage.WriteMessage("\n> Returning " + money + " to customer");
 }