public ActionResult Index() { var games = gameService.GetAllGames(); var models = mapper.Map <IEnumerable <Game>, IEnumerable <GameViewModel> >(games); var model = GamesModel.CreateGameModel(models, UserHelper.IsAdmin(User, context)); SetGenresDevelopers(); return(View(model)); }
public ActionResult Filter(string type, string name) { var games = default(IEnumerable <Game>); var typeNull = string.IsNullOrWhiteSpace(type); var nameNull = string.IsNullOrWhiteSpace(name); if (!typeNull && !nameNull) { AddFilter(type, name); games = gameService.FilterGames(Session["GameFilters"] as List <GameFilter>); } else { games = gameService.GetAllGames(); } var models = mapper.Map <IEnumerable <Game>, IEnumerable <GameViewModel> >(games); var model = GamesModel.CreateGameModel(models, UserHelper.IsAdmin(User, context)); return(PartialView("Partial/GamesPartial", model)); }
public ActionResult Search(string criteria) { var games = default(IEnumerable <Game>); var criteriaNull = string.IsNullOrWhiteSpace(criteria); if (criteriaNull) { games = gameService.GetAllGames(); } else { games = gameService.FindGamesByCriteria(criteria); } var models = mapper.Map <IEnumerable <Game>, IEnumerable <GameViewModel> >(games); var model = GamesModel.CreateGameModel(models, UserHelper.IsAdmin(User, context)); SetGenresDevelopers(); return(PartialView("Partial/GamesPartial", model)); }