Ejemplo n.º 1
0
        public IEnumerable <Platform> GetAllPlatform()
        {
            var platforms           = _platformRepository.GetMany(includes: x => x.Languages);
            var translatedPlatforms = new List <Platform>();

            foreach (var platform in platforms)
            {
                if (platform.Languages != null)
                {
                    translatedPlatforms.Add(_platformTranslate.GetTranslate(_language, platform));
                }
            }

            return(translatedPlatforms);
        }
Ejemplo n.º 2
0
        public IEnumerable <Publisher> GetAllPublishers()
        {
            var publishers           = _publisherRepository.GetMany(includes: x => x.Languages);
            var translatedPublishers = new List <Publisher>();

            foreach (var publisher in publishers)
            {
                if (publisher.Languages != null && publisher.Languages.Any())
                {
                    translatedPublishers.Add(_publisherTranslate.GetTranslate(_language, publisher));
                }
                else
                {
                    translatedPublishers.Add(publisher);
                }
            }

            return(translatedPublishers);
        }
Ejemplo n.º 3
0
        public Game Get(string key, bool isTranslated = true)
        {
            var game = _gameRepository.FirstOrDefault(x => x.Key == key);

            game.GameState = GetGameState(game.Key);


            _unitOfWork.Commit();

            if (isTranslated)
            {
                if (game.Languages != null && game.Languages.Any())
                {
                    game = _gameTranslate.GetTranslate(_language, game);
                }
            }

            return(game);
        }
Ejemplo n.º 4
0
        public IEnumerable <Genre> GetAllGenres()
        {
            var genres = _genreRepository.GetMany(0, int.MaxValue, null, null, SortDirection.Ascending,
                                                  x => x.Languages, x => x.ParentGenre);
            var languageRepo     = _unitOfWork.GetRepository <ICrudRepository <Language> >(RepositoryType.SQL);
            var translatedGenres = new List <Genre>();

            foreach (var genre in genres)
            {
                if (genre.Languages != null && genre.Languages.Any() && _language != null)
                {
                    var currentLanguage    = languageRepo.FirstOrDefault(x => x.Code == _language);
                    var publisherTranslate = genre.Languages.FirstOrDefault(x => x.LanguageId == currentLanguage.Id);

                    if (publisherTranslate != null)
                    {
                        translatedGenres.Add(_genreTranslation.GetTranslate(_language, genre));
                    }
                }
            }

            return(genres);
        }