Example #1
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        // 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));
 }
Example #6
0
        public void TestGetMatchesIsNullByDefault()
        {
            var sut = new MatchListViewModel(GameMode.Solo, GamePerspective.FPP);

            Assert.Null(sut.Matches);
        }