public bool SetPoints(int amount) { if (amount > 0) { points += amount; userDataProxy.EditUserPoints(id, points); return(true); } return(false); }
//for test only //use-case: user can edit is points public bool EditUserPoints(int userId, int newPoints) { bool toReturn = false; IUser user = _sc.GetUserWithId(userId); if (user == null) { return(toReturn); } toReturn = user.EditUserPoints(newPoints); if (toReturn) { _userDataProxy.EditUserPoints(userId, newPoints); } return(toReturn); }
//get amout won, inc winCounter + update point + check if the user is now the highest player public bool Win(int amount) { bool toReturn; try { user.IncWinNum(); user.UpdateHighestCashInGame(amount); user.UpdateTotalProfit(amount); TotalChip += amount; int newPoint = GetNewPoint(); user.EditUserPoints(newPoint); UserDataProxy p = new UserDataProxy(); this.user.EditUserPoints(newPoint); p.EditUserPoints(user.Id(), newPoint); toReturn = true; } catch (Exception e) { toReturn = false; } return(toReturn); }