コード例 #1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var accessories = await _common_repo.Get_All_By_Type(Constant.ACCESSORIES);

            var generes = await _gr_repo.Get_ALL_ActiveAsync();

            var result = await _cat_repo.Get_All_Async();

            if (result != null)
            {
                foreach (var x in result)
                {
                    x.AccessoriesTypes = accessories;
                    string platform_ids = x.Platform_Ids;
                    if (!string.IsNullOrEmpty(platform_ids))
                    {
                        platform_ids = platform_ids.Contains(",") ? platform_ids.Trim(',') : platform_ids;
                        if (platform_ids.Length > 0)
                        {
                            x.PlatformList = await _gp_repo.Get_Supported_N_Platforms(100, platform_ids);

                            x.GenereList = generes;
                        }
                    }
                }
            }
            return(View(result));
        }
コード例 #2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var generes = await _gr_repo.Get_ALL_ActiveAsync();

            var result = await _cat_repo.Get_All_Async();

            var accessories = await _common_repo.Get_All_By_Type(Constant.ACCESSORIES);

            var featureLinks = await _fea_repo.Get_All();

            if (result != null)
            {
                foreach (var x in result)
                {
                    x.AccessoriesTypes = accessories;
                    string platform_ids = x.Platform_Ids;
                    if (!string.IsNullOrEmpty(platform_ids))
                    {
                        platform_ids = platform_ids.Contains(",") ? platform_ids.Trim(',') : platform_ids;
                        if (platform_ids.Length > 0)
                        {
                            x.GenereList   = generes;
                            x.PlatformList = await _gp_repo.Get_Supported_N_Platforms(100, platform_ids);

                            foreach (var xx in x.PlatformList)
                            {
                                xx.FeatureLinks = featureLinks.Where(o => o.Reference_Id == xx.Id && o.Reference_Name == Constant.ImageCategory.PlatformImage).ToList();
                            }
                        }
                    }
                }
            }
            return(View(result));
        }
コード例 #3
0
        public async Task <IActionResult> GameDetails(string platformUrl, string url, string c = "new")
        {
            url         = Regex.Replace(url, "[^a-zA-Z0-9]", "-");
            platformUrl = Regex.Replace(platformUrl, "[^a-zA-Z0-9]", "-");
            int condition   = string.IsNullOrEmpty(c) ? 1 : c.ToUpper().Equals("PRE-OWNED") ? 2 : 1;
            var gameDetails = await _game_repo.Get_Details_By_Url_Platform_n_Condition(url, platformUrl, condition);

            if (gameDetails.Game == null)
            {
                return(NotFound());
            }


            var platform = await _gp_repo.GetByUrlAsync(platformUrl);

            if (platform == null)
            {
                return(NotFound());
            }
            if (!platform.Active)
            {
                return(NotFound());
            }

            gameDetails.Game.Platform = platform;


            string platform_ids = gameDetails.Game.Platforms;

            if (!string.IsNullOrEmpty(platform_ids))
            {
                platform_ids = platform_ids.Contains(",") ? platform_ids.Trim(',') : platform_ids;
                if (platform_ids.Length > 0)
                {
                    gameDetails.Game.SupportedPlatforms = await _gp_repo.Get_Supported_N_Platforms(100, platform_ids);
                }
            }

            string genre_ids = gameDetails.Game.Genres;

            if (!string.IsNullOrEmpty(genre_ids))
            {
                genre_ids = genre_ids.Contains(",") ? genre_ids.Trim(',') : genre_ids;
                if (genre_ids.Length > 0)
                {
                    gameDetails.Game.GenereList = await _gr_repo.Get_Supported_N_Genere(1, genre_ids);

                    gameDetails.Game.Genre = gameDetails.Game.GenereList.FirstOrDefault();
                }
            }

            long platformId = (gameDetails.Game.Platform != null) ? gameDetails.Game.Platform.Id : 0;

            gameDetails.Similar_Games = await _game_repo.GetPaginated_By_PlatformId_ConditionId_From_View(0, 12, platformId, condition);

            foreach (var obj in gameDetails.Similar_Games.PagedSet)
            {
                obj.Platform = platform;
            }

            long genreId = (gameDetails.Game.Genre != null) ? gameDetails.Game.Genre.Id : 0;

            gameDetails.Recommended_Games = await _game_repo.GetPaginated_By_PlatformId_GenreId_ConditionId_From_View(0, 12, platformId, genreId, condition);

            foreach (var obj in gameDetails.Recommended_Games.PagedSet)
            {
                obj.Platform = platform;
            }

            return(View(gameDetails));
        }