Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync()
        {
            var user = await _userManager.GetUserAsync(User);

            var companyId = user.CompanyID;
            await Task.Run(() =>
            {
                Company = db.GetById(companyId);
            });

            if (Company == null)
            {
                return(RedirectToPage("./Create"));
            }
            else
            {
                await Task.Run(() =>
                {
                    var CompanyPicInfo      = picdb.GetIconById((int)companyId);
                    imgDisplay              = CompanyPicInfo == null ? "~/img/notfound.jpg" : @"~/img/" + CompanyPicInfo.Path;
                    piclist                 = new Dictionary <Game, string> {
                    };
                    IEnumerable <Game> Game = dbGame.GetGamesByCompanyId((int)companyId);
                    foreach (var item in Game)
                    {
                        var GamePicInfo    = picgamedb.GetIconById(item.GameId);
                        var imgDisplayGame = GamePicInfo == null ? "~/img/notfound.jpg" : @"~/img/" + GamePicInfo.Path;
                        piclist.Add(item, imgDisplayGame);
                    }
                });

                return(Page());
            }
        }
        public async Task <IActionResult> OnGetAsync(int gameid)
        {
            Game = gamedb.GetById(gameid);
            if (Game == null)
            {
                return(RedirectToPage("./Index"));
            }
            var img = gamepicdb.GetIconById(Game.GameId);

            imgpath = img == null ? "~/img/notfound.jpg" : @"~/img/" + img.Path;

            return(Page());
        }
Ejemplo n.º 3
0
 public async Task OnGetAsync()
 {
     await Task.Run(() =>
     {
         piclist = new Dictionary <Game, string> {
         };
         IEnumerable <Game> Game = db.GetGamesByName(search);
         foreach (var item in Game)
         {
             var GamePicInfo    = picdb.GetIconById(item.GameId);
             var imgDisplayGame = GamePicInfo == null ? "~/img/notfound.jpg" : @"~/img/" + GamePicInfo.Path;
             piclist.Add(item, imgDisplayGame);
         }
     });
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnGetAsync()
        {
            await Task.Run(() =>
            {
                piclist      = new Dictionary <Game, string> {
                };
                var username = userManager.GetUserName(User);
                IEnumerable <WishList> WishList = wishlistdb.GetWishListsByUsername(username);
                foreach (var item in WishList)
                {
                    var Game           = gamedb.GetById(item.GameId);
                    var GamePicInfo    = gamepicdb.GetIconById(item.GameId);
                    var imgDisplayGame = GamePicInfo == null ? "~/img/notfound.jpg" : @"~/img/" + GamePicInfo.Path;
                    piclist.Add(Game, imgDisplayGame);
                }
            });

            return(Page());
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            var user = await userManager.GetUserAsync(User);

            int companyid = (int)user.CompanyID;

            if (id == null)
            {
                return(RedirectToPage("../NotFound"));
            }

            Game = await db.GetByIdAuthorizeAsync(id, companyid);

            if (Game == null)
            {
                return(RedirectToPage("../NotFound"));
            }
            await Task.Run(() =>
            {
                var GamePicInfo         = picdb.GetIconById(Game.GameId);
                Game.HtmlText           = HttpUtility.HtmlDecode(Game.HtmlText);
                imgDisplay              = GamePicInfo == null ? "~/img/notfound.jpg" : @"~/img/" + GamePicInfo.Path;
                ListOfSupportedPlatform = gamePlatformdb.GetAllSupportedPlatform(Game.GameId);
                var platformlist        = platformdb.GetAllByName("");
                if (ListOfSupportedPlatform.Any())
                {
                    foreach (var r1 in ListOfSupportedPlatform)
                    {
                        platformlist = platformlist.Where(s => s.PlatformId != r1.PlatformId);
                    }
                }
                PlatformList    = new SelectList(platformlist, "PlatformId", "Platform_name");
                delGamePlatform = new PlatformOfGame();
                newGamePlatform = new PlatformOfGame();
                //Load info images
                oldInfo = picdb.GetById(Game.GameId, ImageType.Info);
            });

            return(Page());
        }