public ActionResult Index() { //Get Budgets //Get Transactions ViewBag.AccountTypes = accountTypeAdapter.GetAccountTypesByUID(Utilities.GetUsersUID(User.Identity.Name)).Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.AccountType }); var transactionList = transactionsAdapter.GetTransactionsByUID(Utilities.GetUsersUID(User.Identity.Name)); ViewBag.Transactions = transactionList.GetRange(0, (transactionList.Count > 5) ? 5 : transactionList.Count); ViewBag.Categories = categoryAdapter.GetCategories().Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.Category }); ViewBag.Budgets = budgetAdapter.GetBudgetsByUID(Utilities.GetUsersUID(User.Identity.Name)); ViewBag.Frequencies = frequencyAdapter.GetAllFrequencies().Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.Frequency }); //ViewBag.AccountTypes = accountTypeAdapter.GetAccountTypesByUID(Utilities.GetUsersUID(User.Identity.Name)); return(View()); }
public ActionResult Index(BudgetModel BudgetTryingToAdd = null) { ViewBag.IsNotDashboard = true; BudgetAdapter budgetAdapter = new BudgetAdapter(); FrequencyAdapter frequencyAdapter = new FrequencyAdapter(); AccountTypeAdapter accountTypeAdapter = new AccountTypeAdapter(); BudgetModelList pageData = new BudgetModelList { Budgets = budgetAdapter.GetBudgetsByUID(Utilities.GetUsersUID(User.Identity.Name)), Categories = budgetAdapter.GetUniqueCategoryByUID(Utilities.GetUsersUID(User.Identity.Name)), Frequencies = frequencyAdapter.GetAllFrequencies(), AccountTypes = accountTypeAdapter.GetAccountTypesByUID(Utilities.GetUsersUID(User.Identity.Name)) }; if (BudgetTryingToAdd != null) { pageData.NewBudget = BudgetTryingToAdd; } return(View(pageData)); }