public async Task <ResponseMessageViewModel> ChangePassword(ForgotUserNameChangePasswordViewModel model) { var respone = new ResponseMessageViewModel(); var user = await _context.Users .Where(a => a.UserName == model.UserName) .Select(a => a).FirstOrDefaultAsync(); if (user != null) { user.Password = _saltPasswordService.SaltPassword(model.Password); _context.SaveChanges(); respone.success = true; respone.Message = "The password has been changed successfully."; } else { respone.success = false; respone.Message = "Failed to update password."; } return(respone); }
public async Task <IActionResult> Post([FromBody] ForgotUserNameChangePasswordViewModel model) { return(new OkObjectResult(await _registerDesigneeService.ChangePassword(model))); }