public ActionResult UserAccounts(int id) { Debug.WriteLine($"App-Debug: {(nameof(UsersController))} {nameof(UserAccounts)} {id}"); if (!NavItem.IsAResourceRequest(Request)) { var menuSelector = "User"; var identifiers = new Dictionary <string, string> { { "userId", $"{id}" } }; var menuNavItems = ViewBag.Menu = NavItem.TransformNavItems( MvcApplication.NavItems.Where(x => x.Key.StartsWith($"{menuSelector}")) .ToDictionary(x => x.Key, x => x.Value), _siteConnector.Services[SupportServices.Portal], identifiers) .Select(s => s.Value).ToList(); ViewBag.Menu = Menu.ConfigureMenu(menuNavItems, "User.Accounts", new List <string> { "User.Accounts" }, MenuOrientations.Vertical); } return(View("users", new UsersViewModel { Users = _usersViewModel.Users.Where(x => x.AccountId == id).ToList() })); }
public async Task <ActionResult> AccountPayments(int id, int tries = 1) { Debug.WriteLine($"App-Debug: {(nameof(AccountsController))} {nameof(AccountPayments)} {id} {tries}"); var entityType = "Account.Payments"; if (await _siteConnector.Challenge( _identity, $"api/challenge/required/{entityType}/{id}")) { var model = new ChallengeViewModel { MenuType = _menuType, EntityType = entityType, Identifier = $"{id}", Identity = _identity, ReturnTo = $"{_siteConnector.Services[SupportServices.Portal]}views/accounts/{id}/payments", Tries = tries }; MvcApplication.Challenges.Add(model.ChallengeId, model); return(RedirectToAction("Challenge", "Challenge", new { model.ChallengeId })); } await _siteConnector.Challenge(_identity, $"api/challenge/refresh/{entityType}/{id}"); var paymentsView = await _siteConnector.DownloadView(SupportServices.Portal, _identity, $"resources/payments/accounts/{id}"); var accountPaymentsViewModel = new AccountPaymentsViewModel { Account = _accountViewModels.Accounts.FirstOrDefault(x => x.AccountId == id), View = paymentsView }; if (NavItem.IsAResourceRequest(Request)) { return(View("_accountPayments", accountPaymentsViewModel)); } var identifiers = new Dictionary <string, string> { { "accountId", $"{id}" } }; var menuNavItems = NavItem.TransformNavItems( MvcApplication.NavItems .Where(x => x.Key.StartsWith($"{_menuType}")) .ToDictionary(x => x.Key, x => x.Value), _siteConnector.Services[SupportServices.Portal], identifiers ).Select(s => s.Value).ToList(); ViewBag.Menu = Menu.ConfigureMenu(menuNavItems, entityType, new List <string> { $"{entityType}", $"{entityType}.All" }, MenuOrientations.Horizontal); return(View("_accountPayments", accountPaymentsViewModel)); }
public ActionResult Challenge(Guid challengeId) { var formPostbackUrl = new Uri(_siteConnector.Services[SupportServices.Accounts], "accounts/challenge/response").AbsoluteUri; if (!MvcApplication.Challenges.ContainsKey(challengeId) || MvcApplication.Challenges[challengeId].Identity != _identity) { return(RedirectToAction("Failed", "Challenge")); } var model = MvcApplication.Challenges[challengeId]; model.Challenge = GetChallengeForEntityType(model.EntityType); model.MaxTries = _maxChallengeTries; model.ResponseUrl = formPostbackUrl; if (NavItem.IsAResourceRequest(Request)) { return(View(model)); } var identifiers = new Dictionary <string, string> { { "accountId", $"{model.Identifier}" } }; var navItems = MvcApplication.NavItems .Where(x => x.Key.StartsWith($"{model.MenuType}")) .ToDictionary(x => x.Key, x => x.Value); var menuNavItems = NavItem.TransformNavItems( navItems, _siteConnector.Services[SupportServices.Portal], identifiers ).Select(s => s.Value) .ToList(); ViewBag.Menu = Menu.ConfigureMenu( menuNavItems, model.EntityType, new List <string> { model.EntityType }, MenuOrientations.Vertical); return(View(model)); }
public async Task <ActionResult> AccountUsers(int id) { Debug.WriteLine($"App-Debug: {(nameof(AccountsController))} {nameof(AccountUsers)} {id}"); var usersView = await _siteConnector.DownloadView( SupportServices.Portal, _identity, $"resources/users/{id}/accounts/"); var accountUsersViewModel = new AccountUsersViewModel { Account = _accountViewModels.Accounts.FirstOrDefault(x => x.AccountId == id), View = usersView }; if (NavItem.IsAResourceRequest(Request)) { return(View("_accountUsers", accountUsersViewModel)); } var entityType = "Account.User"; var identifiers = new Dictionary <string, string> { { "accountId", $"{id}" } }; var menuNavItems = NavItem.TransformNavItems( MvcApplication.NavItems .Where(x => x.Key.StartsWith($"{_menuType}")) .ToDictionary(x => x.Key, x => x.Value), _siteConnector.Services[SupportServices.Portal], identifiers ).Select(s => s.Value).ToList(); ViewBag.Menu = Menu.ConfigureMenu(menuNavItems, entityType, new List <string> { entityType }, MenuOrientations.Vertical); return(View("_accountUsers", accountUsersViewModel)); }