/// <summary> /// Controller for list of games no validate /// </summary> /// <param name="searchString"></param> /// <param name="sortOrder"></param> /// <param name="currentFilter"></param> /// <param name="pageNumber"></param> /// <returns></returns> public async Task <IActionResult> ProposedGames(string searchString, string sortOrder, string currentFilter, int?pageNumber) { IQueryable <Game> games; if (!String.IsNullOrEmpty(searchString)) { games = _gameService.GetGamesByName(searchString); pageNumber = 1; } else { games = _gameService.GetGames(); searchString = currentFilter; } games = _gameService.GetGamesNoValidate(games); GamesIndexData gamesAllData = await _gameAllDataService.GetGamesAndCategories(games); gamesAllData = _gameAllDataService.GamesPoss(gamesAllData, null); ViewBag.MyGames = "Neither"; return(View(gamesAllData)); }
public async Task <IActionResult> Index(string searchString, string sortOrder, string currentFilter, int?pageNumber) { LudothequeUser user = await UserServices.GetUserAsync(userManager, User.Identity.Name); IQueryable <Game> games; games = _gameService.GetGamesByUser(user.Id); if (!String.IsNullOrEmpty(searchString)) { games = _gameService.GetGamesByName(searchString, games); pageNumber = 1; } else { searchString = currentFilter; } games = _gameService.GetGamesValidate(games); GamesIndexData gamesAllData = await SortGames(searchString, sortOrder, currentFilter, pageNumber, games); gamesAllData = _gameAllDataService.GamesPoss(gamesAllData, user.Id); ViewBag.MyGames = "true"; return(View(gamesAllData)); }
public async Task <IActionResult> Index(string searchString, string sortOrder, string currentFilter, int?pageNumber) { //Todo : Si ecran trop petit afficher des colonnes en moins //Todo : limiter le nombre de catégories montrées a 3 //Todo : Probleme si critères vide sort ne trie pas bien IQueryable <Game> games; if (!String.IsNullOrEmpty(searchString)) { games = _gameService.GetGamesByName(searchString); pageNumber = 1; } else { games = _gameService.GetGames(); searchString = currentFilter; } games = _gameService.GetGamesValidate(games); GamesIndexData gamesAllData = await SortGames(searchString, sortOrder, currentFilter, pageNumber, games); bool isAuthenticated = User.Identity.IsAuthenticated; if (isAuthenticated) { LudothequeUser user = await UserServices.GetUserAsync(userManager, User.Identity.Name); gamesAllData = _gameAllDataService.GamesPoss(gamesAllData, user.Id); } else { gamesAllData = _gameAllDataService.NoGamesPoss(gamesAllData); } return(View(gamesAllData)); }