private static void RankHand(int[] faces, int[] suits, GameModel gameStatus, UserAccount userAccountInfo) { SmartEntities context = new SmartEntities(); if (DeucesWildHandValue.Trips(faces, suits)) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 3 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Three of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "3 OF A KIND"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.Straight || DeucesWildHandValue.RankHand(faces, suits) == HandRanking.BroadwayStraight) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - STRAIGHT"; gameStatus.WinAmount = gameStatus.BetAmount * 2; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Straight"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "STRAIGHT"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.Flush) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - FLUSH"; gameStatus.WinAmount = gameStatus.BetAmount * 2; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "FLUSH"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.FullHouse) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - FULL HOUSE"; gameStatus.WinAmount = gameStatus.BetAmount * 3; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Full House"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "FULL HOUSE"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.Quads) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 4 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 4; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Four of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "4 OF A KIND"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.StraightFlush) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - STRAIGHT FLUSH"; gameStatus.WinAmount = gameStatus.BetAmount * 9; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Straight Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "STRAIGHT FLUSH"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.WildRoyalFlush) { if (gameStatus.GameOver) { gameStatus.WinAmount = gameStatus.BetAmount * 25; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - WILD ROYAL FLUSH"; gameStatus.HandName = "Wild Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "WILD ROYAL FLUSH"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.FiveOfAKind) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 5 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 15; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Five of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "5 OF A KIND"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.FourDeuces) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 4 DEUCES"; gameStatus.WinAmount = gameStatus.BetAmount * 200; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Five of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "4 DEUCES"; } } if (DeucesWildHandValue.RankHand(faces, suits) == HandRanking.RoyalFlush) { if (gameStatus.GameOver) { if (gameStatus.BetAmount == 5) { gameStatus.WinAmount = gameStatus.BetAmount * 800; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH"; gameStatus.HandName = "Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.WinAmount = gameStatus.BetAmount * 250; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH"; gameStatus.HandName = "Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } } else { gameStatus.Message = "ROYAL FLUSH"; } } context.Entry(userAccountInfo).State = EntityState.Modified; gameStatus.Credits = (int)userAccountInfo.Credits; context.SaveChanges(); }
private static void RankHand(int[] faces, int[] suits, GameModel gameStatus, UserAccount userAccountInfo) { SmartEntities context = new SmartEntities(); List <DoubleBonusPayout> paytable = new List <DoubleBonusPayout>(); DoubleBonusPayout payout = new DoubleBonusPayout(); if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.JacksOrBetter) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.JacksOrBetter}"; gameStatus.WinAmount = gameStatus.BetAmount; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.JacksOrBetter; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.TwoPair) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.TwoPair}"; gameStatus.WinAmount = gameStatus.BetAmount * 1; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.TwoPair; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.Trips) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.ThreeOfAKind}"; gameStatus.WinAmount = gameStatus.BetAmount * 3; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.ThreeOfAKind; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.Straight || DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.BroadwayStraight) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.Straight}"; gameStatus.WinAmount = gameStatus.BetAmount * 4; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.Straight; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.Flush) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.Flush}"; gameStatus.WinAmount = gameStatus.BetAmount * 5; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.Flush; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.FullHouse) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.FullHouse}"; gameStatus.WinAmount = gameStatus.BetAmount * 9; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.FullHouse; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.Quads) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.FourFivesThruKings}"; gameStatus.WinAmount = gameStatus.BetAmount * 50; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.FourFivesThruKings; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.StraightFlush) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.StraightFlush}"; gameStatus.WinAmount = gameStatus.BetAmount * 50; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.StraightFlush; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.RoyalFlush) { if (gameStatus.BetAmount == 5) { gameStatus.WinAmount = gameStatus.BetAmount * 800; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.RoyalFlush}"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else if (gameStatus.BetAmount < 5) { gameStatus.WinAmount = gameStatus.BetAmount * 250; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.RoyalFlush}"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.RoyalFlush; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.LowQuads) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.FourTwosThreesFours}"; gameStatus.WinAmount = gameStatus.BetAmount * 80; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.FourTwosThreesFours; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.LowQuadsWithAce) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.FourTwosThreesFoursWithAce}"; gameStatus.WinAmount = gameStatus.BetAmount * 160; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.FourTwosThreesFoursWithAce; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.QuadAces) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.FourAces}"; gameStatus.WinAmount = gameStatus.BetAmount * 160; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.FourAces; } } if (DoubleBonusHandValue.RankHand(faces, suits) == HandRanking.QuadAcesLowKicker) { if (gameStatus.GameOver) { gameStatus.Message = $"{ApplicationConstants.Winner}{ApplicationConstants.FourAcesWithAnyTwoThreeFour}"; gameStatus.WinAmount = gameStatus.BetAmount * 400; gameStatus.Credits += gameStatus.WinAmount; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = ApplicationConstants.FourAcesWithAnyTwoThreeFour; } } context.Entry(userAccountInfo).State = EntityState.Modified; gameStatus.Credits = (int)userAccountInfo.Credits; context.SaveChanges(); }
private static void RankHand(int[] faces, int[] suits, GameModel gameStatus, UserAccount userAccountInfo) { SmartEntities context = new SmartEntities(); if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.JacksOrBetter) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - JACKS OR BETTER"; gameStatus.WinAmount = gameStatus.BetAmount; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Jacks or Better"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "JACKS OR BETTER"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.TwoPair) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - TWO PAIR"; gameStatus.WinAmount = gameStatus.BetAmount * 2; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Two Pair"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "TWO PAIR"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.Trips) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 3 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 3; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Three of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "3 OF A KIND"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.Straight || JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.BroadwayStraight) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - STRAIGHT"; gameStatus.WinAmount = gameStatus.BetAmount * 4; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Straight"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "STRAIGHT"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.Flush) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - FLUSH"; gameStatus.WinAmount = gameStatus.BetAmount * 6; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "FLUSH"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.FullHouse) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - FULL HOUSE"; gameStatus.WinAmount = gameStatus.BetAmount * 9; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Full House"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "FULL HOUSE"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.Quads) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 4 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 25; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Four of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "4 OF A KIND"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.StraightFlush) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - STRAIGHT FLUSH"; gameStatus.WinAmount = gameStatus.BetAmount * 50; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Straight Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "STRAIGHT FLUSH"; } } if (JacksOrBetterHandValue.RankHand(faces, suits) == HandRanking.RoyalFlush) { if (gameStatus.BetAmount == 5) { gameStatus.WinAmount = gameStatus.BetAmount * 800; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH"; gameStatus.HandName = "Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.WinAmount = gameStatus.BetAmount * 250; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH"; gameStatus.HandName = "Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } } context.Entry(userAccountInfo).State = EntityState.Modified; gameStatus.Credits = (int)userAccountInfo.Credits; context.SaveChanges(); }
private static void RankHand(int[] faces, int[] suits, GameModel gameStatus, UserAccount userAccountInfo) { SmartEntities context = new SmartEntities(); if (JokersWildHandValue.KingsOrBetter(faces)) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - PAIR OF KINGS OR BETTER"; gameStatus.WinAmount = gameStatus.BetAmount; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Kings or Better"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "PAIR OF KINGS OR BETTER"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.TwoPair) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - TWO PAIR"; gameStatus.WinAmount = gameStatus.BetAmount; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Two Pair"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "TWO PAIR"; } } if (JokersWildHandValue.Trips(faces)) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 3 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 2; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Three of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "3 OF A KIND"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.Straight || JokersWildHandValue.RankHand(faces, suits) == HandRanking.BroadwayStraight) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - STRAIGHT"; gameStatus.WinAmount = gameStatus.BetAmount * 3; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Straight"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "STRAIGHT"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.Flush) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - FLUSH"; gameStatus.WinAmount = gameStatus.BetAmount * 5; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "FLUSH"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.FullHouse) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - FULL HOUSE"; gameStatus.WinAmount = gameStatus.BetAmount * 7; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Full House"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "FULL HOUSE"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.Quads) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 4 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 17; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Four of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "4 OF A KIND"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.StraightFlush) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - STRAIGHT FLUSH"; gameStatus.WinAmount = gameStatus.BetAmount * 50; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Straight Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "STRAIGHT FLUSH"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.WildRoyalFlush) { if (gameStatus.GameOver) { gameStatus.WinAmount = gameStatus.BetAmount * 100; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH WITH JOKER"; gameStatus.HandName = "Wild Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "ROYAL FLUSH WITH JOKER"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.FiveOfAKind) { if (gameStatus.GameOver) { gameStatus.Message = "WINNER - 5 OF A KIND"; gameStatus.WinAmount = gameStatus.BetAmount * 200; gameStatus.Credits += gameStatus.WinAmount; gameStatus.HandName = "Five of a Kind"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.Message = "5 OF A KIND"; } } if (JokersWildHandValue.RankHand(faces, suits) == HandRanking.RoyalFlush) { if (gameStatus.GameOver) { if (gameStatus.BetAmount == 5) { gameStatus.WinAmount = gameStatus.BetAmount * 800; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH NO JOKERS"; gameStatus.HandName = "Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } else { gameStatus.WinAmount = gameStatus.BetAmount * 250; gameStatus.Credits += gameStatus.WinAmount; gameStatus.Message = "WINNER - ROYAL FLUSH NO JOKERS"; gameStatus.HandName = "Royal Flush"; userAccountInfo.Credits = gameStatus.Credits; context.Entry(userAccountInfo).State = EntityState.Modified; context.SaveChanges(); } } else { gameStatus.Message = "ROYAL FLUSH"; } } context.Entry(userAccountInfo).State = EntityState.Modified; gameStatus.Credits = (int)userAccountInfo.Credits; context.SaveChanges(); }