public async Task <GameViewModel> GetGameViewModelForRegisterAsync() { UsedGamesAPIPlatformResponse response = await _usedGamesAPIPlatforms.GetPlatformsAsync(); if (!response.Success) { return(null); } GameViewModel viewModel = new GameViewModel ( platforms: new SelectList(response.Platforms, "Id", "Name"), imgsPerGame: GetImgsPerGame(), sellerId: _loginManager.GetUserId() ); return(viewModel); }
private async Task <UsedGamesAPIPlatformResponse> GetPlatformsAsync(ActionExecutingContext context) { UsedGamesAPIPlatforms usedGamesAPIPlatforms = (UsedGamesAPIPlatforms)context.HttpContext.RequestServices.GetService(typeof(UsedGamesAPIPlatforms)); return(await usedGamesAPIPlatforms.GetPlatformsAsync()); }