private HomeViewModel SetHomeModel()
        {
            HomeViewModel model = new HomeViewModel();

            Game gameInfo = _gameService.Get().FirstOrDefault();

            if (gameInfo != null)
            {
                model.GameModel = new GameViewModel
                {
                    GameId          = gameInfo.Id,
                    GameType        = gameInfo.GameType,
                    GameName        = gameInfo.GameName,
                    GameDescription = gameInfo.GameDescription,
                    GameLogo        = gameInfo.Logo,
                    GameBanner      = gameInfo.Banner,
                    GameCSSSkin     = gameInfo.CSSSkin,

                    GameSlotType   = gameInfo.GameSlotType,
                    GameSlotsCount = gameInfo.GameSlotsCount,

                    EnableTimer         = gameInfo.EnableTimer,
                    TimerMaxPerQuestion = gameInfo.TimerMaxPerQuestion,
                    DisplayScore        = gameInfo.DisplayScore
                };

                if (model.GameModel.GameType == (int)Game.GameTypeEnum.Slot)
                {
                    model.GameModel.SlotIcons     = _iconService.List(x => x.GameId == model.GameModel.GameId).ToList();
                    model.GameModel.AllowedToPlay = ValidateGameSlotType(gameInfo);
                }
                else
                {
                    model.QuizCategories          = _quizCategoryService.List(x => x.GameId == model.GameModel.GameId).ToList();
                    model.GameModel.AllowedToPlay = true;
                }
            }

            return(model);
        }
Esempio n. 2
0
 public IHttpActionResult Get([FromUri] QuizCategory dto)
 {
     return(Ok(_quizCategoryService.List(dto)));
 }