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 ActionResult ValidatePut(ChangeLocalPassword command, string fieldName = null)
        {
            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));

            if (command == null)
            {
                Response.StatusCode = 400;
                return(Json(null));
            }

            var result = new ValidatedFields(ModelState, fieldName);

            //ModelState[command.PropertyName(x => x.OldPassword)].Errors.Clear();
            //result = new ValidatedFields(ModelState, fieldName);

            return(new CamelCaseJsonResult(result));
        }
        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 ActionResult ValidatePut(ChangeLocalPassword command, string fieldName = null)
        {
            //System.Threading.Thread.Sleep(new Random().Next(5000, 5001));

            if (command == null)
            {
                Response.StatusCode = 400;
                return Json(null);
            }

            var result = new ValidatedFields(ModelState, fieldName);

            //ModelState[command.PropertyName(x => x.OldPassword)].Errors.Clear();
            //result = new ValidatedFields(ModelState, fieldName);

            return new CamelCaseJsonResult(result);
        }