public ServiceResult ChangeCoinPassword(ClientChangeCoinPasswordRequest request) { return(Json(() => { var res = clientService.ChangeCoinPassword(request); return ObjectResult(res); }, "修改密码失败")); }
public bool ChangeCoinPassword(ClientChangeCoinPasswordRequest request) { var client = (from p in Context.Clients where p.ClientId == ClientId select p).FirstOrDefault(); if (client == null) { throw new ZzbException("找不到当前登录用户"); } if (!string.IsNullOrEmpty(client.CoinPassword) && client.CoinPassword != SecurityHelper.Encrypt(request.oldCoinPassword)) { throw new ZzbException("旧资金密码不正确"); } client.CoinPassword = SecurityHelper.Encrypt(request.newCoinPsssword); client.Update(); Context.ClientOperateLogs.Add(new ClientOperateLog(client.ClientId, "修改资金密码")); return(Context.SaveChanges() > 0); }