public void GetExpensesPerCategory()
        {
            CategoryExpensesCollection.Clear();
            float totalExpensesAmmount = Expense.TotalExpensesAmmount();

            foreach (string c in Categories)
            {
                var   expenses = Expense.GetExpenses(c);
                float expensesAmmountInCategory = expenses.Sum(e => e.Ammount);

                CategoryExpenses ce = new CategoryExpenses()
                {
                    Category           = c,
                    ExpensesPercentage = expensesAmmountInCategory / totalExpensesAmmount
                };
                CategoryExpensesCollection.Add(ce);
            }
        }
Exemple #2
0
        public void GetExpensesPerCategory()
        {
            CategoryExpensesCollection.Clear();
            float totalExpensesAmount = Expense.GetTotalExpensesAmount();

            foreach (var category in Categories)
            {
                var   expenses = Expense.GetExpenses(category);
                float expensesAmountInCategory = expenses.Sum(e => e.Amount);

                CategoryExpenses categoryExpenses = new CategoryExpenses()
                {
                    Category           = category,
                    ExpensesPercentage = expensesAmountInCategory / totalExpensesAmount
                };

                CategoryExpensesCollection.Add(categoryExpenses);
            }
        }