public JoinNextHandResult JoinNextHand(JoinNextHandRequest request) { var result = new JoinNextHandResult(); try { var player = _cache.RefreshAndGet( Players, request.Player, new PlayerNotFoundException(string.Format("Cannot find player id: {0}, please exit and re-enter the room.", request.Player)) ); var user = _cache.RefreshAndGet( Users, request.UserName, new UserNotFoundException(string.Format("Cannot find user name: {0}, please login to the server again.", request.UserName)) ); UserManager.SecurityCheck(request.SecurityKey, user); user.JoinNextHand(player, request.SeatIndex, request.BuyIn); result.UserBank = user.UserBank.Money; result.Wallet = player.Wallet.AmountOfMoney; result.Success = true; } catch (PokerException e) { result.Success = false; result.ErrorMessage = e.Message; Logger.Error(e, this); } return(result); }
public double JoinNextHand(string userName, int key, int?player, int seatIndex, double buyIn, out double wallet) { JoinNextHandResult result = roomService.JoinNextHand(new JoinNextHandRequest() { UserName = userName, Player = (int)player, SeatIndex = seatIndex, BuyIn = buyIn, SecurityKey = key }); if (!result.Success.HasValue || !result.Success.Value) { string e = result.ErrorMessage; wallet = 0; return(0); } wallet = result.Wallet; return(result.UserBank); }
public HttpResponseMessage JoinNextHand(JoinNextHandRequest request) { var result = new JoinNextHandResult(); try { result = service.JoinNextHand(request); } catch (Exception e) { result.ErrorMessage = e.Message; result.Success = false; return(Request.CreateResponse(HttpStatusCode.InternalServerError, result)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }