public async Task <IActionResult> DisableEnableAccountAsync([FromBody] DisableEnableAccountRequestDto request) { var managerAccountBiz = new ManagerAccountBiz(); var entity = await managerAccountBiz.GetAsync(request.UserGuid); if (entity == null) { return(Failed(ErrorCode.UserData, "找不到数据")); } entity.LastUpdatedBy = UserID; entity.LastUpdatedDate = DateTime.Now; entity.Enable = request.Enable; var result = await managerAccountBiz.UpdateAsync(entity); if (!result) { return(Failed(ErrorCode.UserData, "修改失败")); } return(Success()); }
public async Task <IActionResult> UpdateAccountPasswordAsync([FromBody] UpdateAccountPasswordRequestDto request) { var managerAccountBiz = new ManagerAccountBiz(); var entity = await managerAccountBiz.GetAsync(UserID); if (entity == null) { return(Failed(ErrorCode.UserData, "找不到数据")); } if (entity.Password != CryptoHelper.AddSalt(entity.UserGuid, request.OldPassword)) { return(Failed(ErrorCode.UserData, "旧密码输入错误")); } entity.LastUpdatedBy = UserID; entity.LastUpdatedDate = DateTime.Now; entity.Password = CryptoHelper.AddSalt(entity.UserGuid, request.Password); var result = await managerAccountBiz.UpdateAsync(entity); if (!result) { return(Failed(ErrorCode.UserData, "修改失败")); } return(Success()); }