public int AddNewHomeBudget(HomeBudget homeBudget)
        {
            homeBudgets.Add(homeBudget);
            _jsonservice.SaveHomeBudgets(homeBudgets);

            return(homeBudget.Id);
        }
Esempio n. 2
0
        //**************************METHODS***********************************
        private void PopulateFormLoad()
        {
            Random rand = new Random();
            //create 3 BusinessBudgets
            BusinessBudget bb1 = new BusinessBudget(rand.Next(1000, 10001), rand.Next(1000, 10000).ToString(), new DateTime(2019, 08, 27), "VFX");
            BusinessBudget bb2 = new BusinessBudget(rand.Next(1000, 10001), rand.Next(1000, 10000).ToString(), new DateTime(2020, 04, 10), "Art");
            BusinessBudget bb3 = new BusinessBudget(rand.Next(1000, 10001), rand.Next(1000, 10000).ToString(), new DateTime(2021, 05, 24), "Level Design");

            //add to list
            budgetList.Add(bb1);
            budgetList.Add(bb2);
            budgetList.Add(bb3);
            //add to dictionary
            budgetDictionary.Add(bb1.BudgetCode, bb1.Balance);
            budgetDictionary.Add(bb2.BudgetCode, bb2.Balance);
            budgetDictionary.Add(bb3.BudgetCode, bb3.Balance);
            //create 3 HomeBudgets
            HomeBudget hb1 = new HomeBudget(rand.Next(1000, 10001), rand.Next(1000, 10000).ToString(), new DateTime(2019, 08, 27), Category.Cleaning);
            HomeBudget hb2 = new HomeBudget(rand.Next(1000, 10001), rand.Next(1000, 10000).ToString(), new DateTime(2020, 04, 10), Category.Clothing);
            HomeBudget hb3 = new HomeBudget(rand.Next(1000, 10001), rand.Next(1000, 10000).ToString(), new DateTime(2021, 05, 24), Category.Food);

            //add to list
            budgetList.Add(hb1);
            budgetList.Add(hb2);
            budgetList.Add(hb3);
            //add to dictionary
            budgetDictionary.Add(hb1.BudgetCode, hb1.Balance);
            budgetDictionary.Add(hb2.BudgetCode, hb2.Balance);
            budgetDictionary.Add(hb3.BudgetCode, hb3.Balance);
        }
        private int AddNewHomeBudget(int monthNumber, string month, decimal earnings, decimal fixedExpenses, decimal variableExpenses, decimal irregularExpenses, decimal balance, decimal finalBalance)
        {
            HomeBudget homeBudget = new HomeBudget(monthNumber, month, earnings, fixedExpenses, variableExpenses, irregularExpenses, balance, finalBalance);

            _homeBudgetService.AddNewHomeBudget(homeBudget);

            return(monthNumber);
        }
 public int AddNewHomeBudget(HomeBudget homeBudget) =>
 _homeBudgetRepository.AddNewHomeBudget(homeBudget);