/// <summary> /// Sums the Expense DataList Values. Sorts all Expense SubCategories. /// </summary> public void UpdateExpense() { ExpenseTotal = ExpenseDataList.Sum(x => x.Amount); NetDifference = IncomeTotal - ExpenseTotal; if (Expense.AllExpenseCategories != null) { Expense.AllExpenseCategories = SortCategories(ExpenseDataList.ToList(), Expense.AllExpenseCategories); } }
/// <summary> /// Sums AllSubCategories. Replaces the old list with a new one. /// </summary> public void SortCategories() { if (Income.AllIncomeCategories.Count > 0) { Income.AllIncomeCategories = SortCategories(IncomeDataList.ToList(), Income.AllIncomeCategories); } if (Expense.AllExpenseCategories.Count > 0) { Expense.AllExpenseCategories = SortCategories(ExpenseDataList.ToList(), Expense.AllExpenseCategories); } }