예제 #1
0
        private void PerformAction(ConsoleKeyInfo actionKey)
        {
            switch (char.GetNumericValue(actionKey.KeyChar))
            {
            case (double)Operation.AddIncome:
            {
                var financeAmount = GetFinanceAmount();
                _financeNoteService.AddIncomeNote(financeAmount);
                Console.WriteLine(AddingIsSuccessful);
                break;
            }

            case (double)Operation.AddExpense:
            {
                var financeAmount = GetFinanceAmount();
                _financeNoteService.AddExpenseNote(financeAmount);
                Console.WriteLine(AddingIsSuccessful);
                break;
            }

            case (double)Operation.ShowIncomes:
            {
                var financeNotes = _financeNoteService.GetAllIncomes();
                _reporter.SaveReport(financeNotes, "Your incomes: ");
                break;
            }

            case (double)Operation.ShowExpenses:
            {
                var financeNotes = _financeNoteService.GetAllExpenses();
                _reporter.SaveReport(financeNotes, "Your expenses: ");
                break;
            }

            case (double)Operation.ShowTotalFinancialFlow:
            {
                Console.Write("Your financial flow: ");
                var totalFinancialFlow = _financeFlowAnalyzer.GetTotalFinanceFlow();
                Console.WriteLine($"{totalFinancialFlow}$");
                break;
            }
            }
        }
예제 #2
0
        public IActionResult AddIncome([FromQuery] decimal financeAmount)
        {
            _financeNoteService.AddIncomeNote(financeAmount);

            return(Ok(NoteAddingSuccessMessage));
        }