public ActionResult Games() { var paginInfo = new PagingInfo { PaginationType = PaginationType.TenPerPage, TotalItems = _gameService.Get().Count(), CurrentPage = 1 }; var model = new GameFilterViewModel { Games = Mapper.Map <IEnumerable <ShowGameViewModel> >( _gameService.GetPaginated( (int)paginInfo.PaginationType, (paginInfo.CurrentPage - 1) * (int)paginInfo.PaginationType)), Genres = Mapper.Map <List <GenreViewModel> >( _genreService.Get().Where(_ => _.ParentGenre == null)), Platforms = Mapper.Map <List <PlatformTypeViewModel> >( _platformTypeService.Get()), Publishers = Mapper.Map <List <PublisherViewModel> >( _publisherService.Get()), PagingInfo = paginInfo }; return(View(model)); }
// // GET: /Match/ public ActionResult Index(GameFilterViewModel model) { ViewBag.TeamItems = listItems.TeamsOnly(); ViewBag.SeasonItems = listItems.Seasons(); if (model.Team == 0 && model.Season == 0) { model.Season = Convert.ToInt64(ViewBag.SeasonItems[0].Value); model.Team = Convert.ToInt64(ViewBag.TeamItems[0].Value); } ViewBag.CompetitionItems = listItems.CompetitionsOfTeam(model.Team); IList <Game> games = gamedao.GetByFilter(model); ViewBag.Games = games; return(View()); }
// // GET: /Stats/ public ActionResult Index(GameFilterViewModel model) { ViewBag.TeamItems = listItems.TeamsOnly(); ViewBag.SeasonItems = listItems.Seasons(); if (model.Team == 0 && model.Season == 0) { model.Season = Convert.ToInt64(ViewBag.SeasonItems[0].Value); model.Team = Convert.ToInt64(ViewBag.TeamItems[0].Value); } ViewBag.CompetitionItems = listItems.CompetitionsOfTeam(model.Team); IList <Game> games = gamedao.GetByFilter(model); GameStatsManager gsm = new GameStatsManager(games); ViewBag.Results = gsm.Results(); ViewBag.Stats = gsm.OverAllStats(); ViewBag.ResultsShooters = gsm.Shooters(); ViewBag.ResultsGoals = gsm.Goals(); return(View()); }
public ActionResult Games(GameFilterViewModel filters, int page = 1) { var model = new GameFilterViewModel(); if (filters.PagingInfo == null) { model.PagingInfo = filters.PagingInfo = new PagingInfo { PaginationType = PaginationType.TenPerPage, TotalItems = _gameService.Get().Count() }; } filters.PagingInfo.CurrentPage = page; if (filters.PagingInfo.PaginationType == PaginationType.All) { model.Games = Mapper.Map <List <ShowGameViewModel> >( _gameService.GetFiltered(Mapper.Map <GameFilterInput>(filters))); } else { filters.PagingInfo.TotalItems = _gameService.Get().Count(); model.PagingInfo = filters.PagingInfo; model.Games = Mapper.Map <List <ShowGameViewModel> >( _gameService.GetFiltered( Mapper.Map <GameFilterInput>(filters), (int)filters.PagingInfo.PaginationType, (filters.PagingInfo.CurrentPage - 1) * (int)filters.PagingInfo.PaginationType)); } return(PartialView("_GameList", model)); }
public IList <Game> GetByFilter(GameFilterViewModel filter) { return(em.GetByFilter(filter.Team, filter.Season, filter.Competition)); }