public async Task <ResultModel <EResultStatus> > ChangePasswordAsync(ChangePasswordVm appUserChangePasswordVm) { await ValidationChangePasswordAsync(appUserChangePasswordVm); if (HasError) { return(CreateInvalidResult <EResultStatus>()); } var result = await _appUserService .ChangePasswordAsync(appUserChangePasswordVm.NewPassword, UserId); return(CreateResult(result)); }
public async Task <ActionResult> ChangePasswordAsync(ChangePassword model) { if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage).ToList(); return(BadRequest(new ErrorResponse(HttpStatusCode.BadRequest, "Validation error", errors))); } var result = await _appUserService.ChangePasswordAsync(model); return(result.Succeed ? NoContent() : BadRequest(new ErrorResponse(HttpStatusCode.BadRequest, "Chage password fail", result.Errors))); }