private ViewGameModel GetGameViewModel() { var currentState = this._slotMachine.GetCurrentState(); var model = new ViewGameModel() { Deposit = currentState.Deposit, WinniningAmount = currentState.CurrentWiningAmount, PayLines = currentState.Paylines .Select(x => x.GetAllSlots()) .Select(x => string.Join("|", x.Select(y => y.Value))) }; return(model); }
public IActionResult GetSpecificGame(int id) { var result = new ViewGameModel(); try { result = context.GameByIdConvertedToViewModel(id); if (context.CheckIfUserHasAlreadyVoted(UserId, id)) { result.Score.Id = -1; return(Ok(result)); } return(Ok(result)); } catch (Exception) { return(NotFound("No game by that Id found.")); } }