Exemplo n.º 1
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index([FromServices] MusicStoreContext dbContext, ManageMessageId?message = null)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var user = await GetCurrentUserAsync();

            var orderHistory = MSOrderHistory.GetOrderHistory(dbContext, user);
            var model        = new IndexViewModel
            {
                HasPassword       = await UserManager.HasPasswordAsync(user),
                HasOrders         = await orderHistory.HasOrdersAsync(),
                PhoneNumber       = await UserManager.GetPhoneNumberAsync(user),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(user),
                Logins            = await UserManager.GetLoginsAsync(user),
                BrowserRemembered = await SignInManager.IsTwoFactorClientRememberedAsync(user)
            };

            return(View(model));
        }
Exemplo n.º 2
0
        //
        // GET: /Account/ViewOrders
        public async Task <ActionResult> ViewOrders()
        {
            var user = await GetCurrentUserAsync();

            if (user == null)
            {
                return(View("Error"));
            }
            var orderHistory = MSOrderHistory.GetOrderHistory(DbContext, user);

            var viewModel = new ViewOrdersViewModel
            {
                Orders     = await orderHistory.GetOrders(),
                OrderTotal = await orderHistory.GetOrdersTotal(),
            };

            return(View(viewModel));
        }