public void Perches(Person person, Produkt produkt) { moneyList(); bool go = true; while (go) { int moneyIndex = AskUserForNumberX("value"); person.Balance = moneyArray[moneyIndex - 1]; if (produkt.Price > person.Balance) { Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{produkt.Name} for {produkt.Price}: SEK."); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Can not buy for: " + person.Balance + ": Sek, you need more money!"); Console.ResetColor(); go = false; } else { Console.Clear(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{person.Name} Bought: {produkt.Name} for {produkt.Price}: SEK. Item was send to the card"); Console.ResetColor(); person.Balance -= produkt.Price; person.Perches(produkt); Console.WriteLine("Your remaining money is: " + person.Balance + ": SEK"); go = false; } } }
public void Perches(Produkt item) { cart.Add(item); }