コード例 #1
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            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.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : message == ManageMessageId.UserDeleteError ? "An error has occurred deleting user."
                : message == ManageMessageId.Error ? "An error has occurred."
                : "";
            if (message == ManageMessageId.UserDeleteError || message == ManageMessageId.Error)
            {
                ViewBag.MessageTypeClass = GenericData.MessageTypeClass(GenericData.MessageTypes.Danger);
            }
            else if (ViewBag.StatusMessage != "")
            {
                ViewBag.MessageTypeClass = GenericData.MessageTypeClass(GenericData.MessageTypes.Success);
            }
            var userId = User.Identity.GetUserId();
            var model  = new IndexViewModel
            {
                HasPassword       = HasPassword(),
                PhoneNumber       = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };

            return(View(model));
        }
コード例 #2
0
 public ActionResult Index(string message, GenericData.MessageTypes?messageType)
 {
     if (messageType != null || !message.IsNullOrWhiteSpace())
     {
         ViewBag.StatusMessage    = message;
         ViewBag.MessageTypeClass = GenericData.MessageTypeClass((GenericData.MessageTypes)messageType);
     }
     return(View());
 }
        // GET: Customers
        public ActionResult Index(string message, GenericData.MessageTypes?messageType)
        {
            var customers = _context.Customers.Include(c => c.MembershipType).ToList();

            if (messageType != null || !message.IsNullOrWhiteSpace())
            {
                ViewBag.StatusMessage    = message;
                ViewBag.MessageTypeClass = GenericData.MessageTypeClass((GenericData.MessageTypes)messageType);
            }
            return(View(customers));
        }