public virtual async Task <ActionResult> Put(ChangeLocalPassword command)
        {
            if (command == null)
            {
                return(View(MVC.Errors.Views.BadRequest));
            }

            if (!ModelState.IsValid)
            {
                var userId = User.Identity.GetUserId <int>();
                var user   = await _queries.Execute(new UserViewBy(userId));

                var model = new ChangeLocalPasswordModel
                {
                    UserView = user,
                    Command  = command,
                };
                return(View(MVC.Security.Views.User.ChangePassword, model));
            }

            await _commands.Execute(command);

            TempData.Alerts("**Your password was updated successfully.**", AlertFlavor.Success, true);
            return(RedirectToAction(await MVC.UserPassword.Index()));
        }
        public virtual async Task <ActionResult> Index()
        {
            var userId = User.Identity.GetUserId <int>();
            var user   = await _queries.Execute(new UserViewBy(userId));

            var localMembership = await _queries.Execute(new LocalMembershipByUser(userId));

            if (localMembership != null)
            {
                var model = new ChangeLocalPasswordModel
                {
                    UserView = user,
                    Command  = new ChangeLocalPassword(),
                };
                return(View(MVC.Security.Views.User.ChangePassword, model));
            }
            else
            {
                var model = new CreateLocalMembershipModel
                {
                    UserView = user,
                    Command  = new CreateLocalMembership(),
                };
                return(View(MVC.Security.Views.User.CreatePassword, model));
            }
        }