public async Task <IActionResult> Index( CancellationToken cancellationToken = default) { try { SERVICES.Match[] matches = await _matchService.GetMatchesAsync(); var model = new MatchListViewModel(); model.Matches = matches .Select(x => _mapper.Map <SERVICES.Match, MatchViewModel>(x, opts => { opts.AfterMap((src, dest) => { dest.AwayTeamName = src.AwayTeam.Name; dest.HomeTeamName = src.HomeTeam.Name; }); })) .ToArray(); return(View(model)); } catch (Exception ex) { return(this.HandleException(ex, message: ex.Message, logger: _logger)); } }
public IActionResult MatchList() { MatchListViewModel matchlistVM = new MatchListViewModel(); matchlistVM.Matches = db.Matches.ToList <Match>(); matchlistVM.NumberOfMatches = matchlistVM.Matches.Count; return(View(matchlistVM)); }
public ActionResult Index(string season_Id, MatchListViewModel model, FormCollection collection) { var seasons = RetrieveSeasons(); ViewBag.sezonaID = seasons; Organization org = Session["MyClub"] as Organization; model.result = RetrieveSeasonMatches(org.Id, Int32.Parse(season_Id)); return(View(model)); }
// GET: Match public ActionResult Index() { MatchListViewModel model = new MatchListViewModel(); model.result = new List <ResultsListViewModel>(); Organization org = Session["MyClub"] as Organization; var seasons = RetrieveSeasons(); model.result = RetrieveSeasonMatches(org.Id, Int32.Parse(seasons.Last().Value)); ViewBag.sezonaID = seasons; return(View(model)); }
public MatchPageTest() { Client = new TestClient(); _listViewModel = new MatchListViewModel(new DataSeedService <Match>(Client), new DataSeedService <Access>(Client)); }
public void TestGetMatchesIsNullByDefault() { var sut = new MatchListViewModel(GameMode.Solo, GamePerspective.FPP); Assert.Null(sut.Matches); }