public ShellViewModel(IStellarService stellarService, IOfferConsumerService offerConsumerService) { FlyoutViewModels = new BindableCollection <FlyoutBaseViewModel>(); OfferOverviewViewModel = new OfferOverviewViewModel(offerConsumerService); OfferOverviewViewModel.Header = "Latest offers"; PaymentOverviewViewModel = new PaymentOverviewViewModel(stellarService); TransactionOverviewViewModel = new TransactionOverviewViewModel(stellarService); TransactionOverviewViewModel.Header = "Latest transactions"; MapViewModel = new MapViewModel(); }
public ActionResult Index(int id) { var userHasAccess = false; var usersContext = _accountLogic.GetAccountUsers(id).ToList(); foreach (var user in usersContext) { if (user.Username == HttpContext.Session.GetString("UserSession")) { userHasAccess = true; } } if (!userHasAccess) { return(RedirectToAction("Index", "Account")); } var accountDetails = _accountLogic.GetAccountById(id); var categoriesContext = _transactionLogic.GetCategories(); var categories = categoriesContext.Select(category => new SelectListItem(category.Name, category.Name)).ToList(); ViewBag.Categories = categories; ViewBag.BillId = id; ViewBag.BillName = accountDetails.AccountName; ViewBag.Balance = accountDetails.AccountBalance; ViewBag.FileProvider = _fileProvider.GetDirectoryContents("wwwroot/Icons/Category").ToList().Select(icon => icon.Name).ToList(); ViewBag.Savings = _savingLogic.GetOngoingUserSavings((int)HttpContext.Session.GetInt32("UserId")); ViewBag.Accounts = _accountLogic.GetUserAccounts(HttpContext.Session.GetString("UserSession")); ViewBag.Users = _userLogic.GetAllUsers(); var transactionsContext = _transactionLogic.GetBillTransactions(id); var transactions = transactionsContext.Select(trans => new TransactionsViewModel(trans.TransactionId, trans.AccountId, trans.TransactionName, trans.TransactionAmount, trans.Category, trans.IconId, trans.TimeOfTransaction, _fileProvider.GetDirectoryContents("wwwroot/Icons/Bill").ToList().Select(icon => icon.Name).ToList())).ToList(); var scheduledTransactionsContext = _transactionLogic.GetAccountScheduledTransactions(id); var scheduledTransactions = scheduledTransactionsContext.Select(trans => new TransactionsViewModel(trans.TransactionId, trans.AccountId, trans.TransactionName, trans.TransactionAmount, trans.Category, trans.IconId, trans.TimeOfTransaction, _fileProvider.GetDirectoryContents("wwwroot/Icons/Bill").ToList().Select(icon => icon.Name).ToList())).ToList(); var model = new TransactionOverviewViewModel(transactions, scheduledTransactions); return(View("~/Views/Transaction/Transactions.cshtml", model)); }