Ejemplo n.º 1
0
        public string ReviewRecord(string name)
        {
            IncomeRecord record = records.FirstOrDefault(x => x.HolderName == name);
            string       result = record.ToString();

            return(result);
        }
Ejemplo n.º 2
0
        public string AddNewRecord(string newName, decimal income)
        {
            decimal      taxedAmount = taxMachine.ApplyTaxation(income);
            IncomeRecord newRecord   = new IncomeRecord(newName, income, taxedAmount);

            records.Add(newRecord);
            return(newRecord.ToString());
        }
Ejemplo n.º 3
0
        public void UpdateRecord(string name)
        {
            IncomeRecord record       = records.FirstOrDefault(x => x.HolderName == name);
            decimal      oldIncome    = record.Amount;
            string       prompt       = $"? Old Income: {oldIncome}; Enter new income ";
            string       errorMessage = "! Invalid input - please enter income as a positive decimal value";
            decimal      newAmount    = Terminal.DecimalInput(prompt, errorMessage, false);

            record.UpdateAmount(newAmount);
            record.UpdateNetAmount(taxMachine.ApplyTaxation(record.Amount));
        }
Ejemplo n.º 4
0
        public bool RemoveRecord(string name)
        {
            IncomeRecord record = records.FirstOrDefault(x => x.HolderName == name);

            if (record != null)
            {
                records.Remove(record);
                return(true);
            }
            else
            {
                return(false);
            }
        }