Exemplo n.º 1
0
        public async Task <IActionResult> ChangePassword([FromBody] ChangePasswordModel model)
        {
            #region Validate Model

            //var userInputValidated = _changePasswordValidator.Validate(model);

            //if (!userInputValidated.IsValid)
            //    return BadRequest(new {
            //        Succeeded = false,
            //        Message = _badRequest.ShowError(int.Parse(userInputValidated.Errors[0].ErrorMessage))
            //    });

            #endregion

            var changedPassword = await _user.ChangePassword(model);

            return(Ok(changedPassword));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ChangePassword([FromBody] ChangePasswordModel model)
        {
            #region Validate Model

            var userInputValidated = _changePasswordValidator.Validate(model);

            if (!userInputValidated.IsValid)
            {
                _infos.Add(_badRequest.ShowError(int.Parse(userInputValidated.Errors[0].ErrorMessage)).Message);

                return(BadRequest(new CustomResponse <string> {
                    Message = _infos
                }));
            }

            #endregion

            var changedPassword = await _user.ChangePassword(model);

            return(Ok(changedPassword));
        }