Beispiel #1
0
        /// <summary>
        ///     This is to get full information about certain game
        /// </summary>
        /// <param name="gameId"></param>
        /// <returns></returns>
        public async Task <GameObject> GetGameObjectAsync(int gameId)
        {
            // find game in database
            Game gameBox = await creationRepository.FindById(gameId).ConfigureAwait(false);

            if (gameBox == null)
            {
                return(null);
            }

            // find the creator of the game
            CreationInfo creationInfo = creationService.GetCreationInfo(gameBox.GameId);

            // load level infos
            IEnumerable <LevelInfo> levelInfos = gameLevelService.GetLevels(gameBox);

            var game = new GameObject
            {
                GameId  = gameBox.GameId,
                Creator = creationInfo
                          .CreatorNickname, //TODO: V3080 https://www.viva64.com/en/w/v3080/ Possible null dereference. Consider inspecting 'creationInfo'.
                LevelInfos = levelInfos.ToList()
            };

            return(game);
        }
Beispiel #2
0
        public async Task <int> DeleteCreation(int id)
        {
            Game game = await CreationRepository.FindById(id);

            int deletionsCount = await CreationRepository.Remove(game);

            return(deletionsCount);
        }