Exemple #1
0
        public virtual IEnumerable <TDomain> Get(string cultureCode, params Expression <Func <TDomain, object> >[] includeProperties)
        {
            var items = _genericRepository.Get(includeProperties).ToList();

            foreach (var item in items)
            {
                LocalizationProvider.Localize(item, cultureCode);
            }

            return(items);
        }
Exemple #2
0
        public IEnumerable <Publisher> GetAllPublishersAndMarkSelected(IEnumerable <string> selecredPublishers, string cultureCode)
        {
            IEnumerable <Publisher> publishers = _publisherRepository.Get().ToList();

            foreach (var publisher in publishers)
            {
                LocalizationProvider.Localize(publisher, cultureCode);
            }

            if (selecredPublishers != null)
            {
                foreach (var item in publishers)
                {
                    if (selecredPublishers.Contains(item.CompanyName))
                    {
                        item.IsChecked = true;
                    }
                }
            }

            return(publishers);
        }
Exemple #3
0
        public IEnumerable <PlatformType> GetAllPlatformTypesAndMarkSelected(IEnumerable <string> selecredPlatforms, string cultureCode)
        {
            IEnumerable <PlatformType> platforms = _platformTypeRepository.Get().ToList();

            foreach (var platform in platforms)
            {
                LocalizationProvider.Localize(platform, cultureCode);
            }

            if (selecredPlatforms != null)
            {
                foreach (var item in platforms)
                {
                    if (selecredPlatforms.Contains(item.Id))
                    {
                        item.IsChecked = true;
                    }
                }
            }

            return(platforms);
        }
Exemple #4
0
        public IEnumerable <Genre> GetAllGenresAndMarkSelectedForFilter(IEnumerable <string> selecredGenres, string cultureCode)
        {
            IEnumerable <Genre> genres = _genreRepository.Get().ToList();

            foreach (var genre in genres)
            {
                LocalizationProvider.Localize(genre, cultureCode);
            }

            if (selecredGenres != null)
            {
                foreach (var item in genres)
                {
                    if (selecredGenres.Contains(item.Id))
                    {
                        item.IsChecked = true;
                    }
                }
            }

            return(genres);
        }
 public IEnumerable <Comment> GetAllCommentsByGameKey(string gameKey)
 {
     return(_commentRepository.Get(x => x.Game.Key == gameKey).ToList());
 }
        public virtual IEnumerable <TDomain> Get(params Expression <Func <TDomain, object> >[] includeProperties)
        {
            var result = SqlDataRepository.Get(includeProperties).Union(GetRequiredMongoCollection());

            return(result);
        }
Exemple #7
0
        public override void Add(Game item, string cultureCode)
        {
            AssignIdIfEmpty(item);
            if (item.Genres == null)
            {
                item.Genres = item.NameGenres != null?_genreRepository.LoadDomainEntities(item.NameGenres) : _genreRepository.Get(genre => genre.Locals.Any(z => z.Name == "Other")).ToList();
            }

            item.PlatformTypes = item.NamePlatformTypes != null?_platformRepository.LoadDomainEntities(item.NamePlatformTypes) : null;

            if (item.Publisher != null)
            {
                item.Publisher = _publisherRepository.GetItemById(item.Publisher.Id);
            }

            if (!item.Locals.Any())
            {
                item.Locals = new List <GameLocal>()
                {
                    new GameLocal()
                    {
                        Culture = new Culture()
                        {
                            Code = cultureCode
                        },
                        Description = item.Description
                    }
                };
            }

            _gameRepository.Add(item);
            UnitOfWork.Save();
            Logger.Write(Operation.Insert, item);
        }