Beispiel #1
0
 private static void SpecifiedSpendings(SpendingsRepository spendingsRepository)
 {
     while (true)
     {
         Console.Clear();
         Console.WriteLine("To exit enter 0.");
         var category = Spending.ChooseCategory();
         if (category == 0)
         {
             return;
         }
         spendingsRepository.ShowByCategory((SpendingCategory)category);
         Console.ReadLine();
     }
 }
Beispiel #2
0
        public static Spending Create()
        {
            Spending spending = new Spending();
            double   money;

            Console.WriteLine("Enter an amount of money.");
            while (!double.TryParse(Console.ReadLine(), out money) || !money.IsPositive())
            {
                Console.WriteLine("Wrong input. Please, try again.");
            }

            SpendingCategory category = (SpendingCategory)Spending.ChooseCategory();

            spending.Category    = category;
            spending.MoneyAmount = money;
            spending.Date        = DateTimeOffset.UtcNow;

            Logger.Log.Info("New spending was created");
            return(spending);
        }