Exemplo n.º 1
0
        private void AddForm(Resource resource, string gameId, bool isEnabled)
        {
            var form = new Form(NavigationForm)
            {
                Action = _uriHelper.GetPastGameDateTimesUri(gameId),
                Method = "post",
                IsEnabled = isEnabled
            };

            resource.AddForm(form);
        }
Exemplo n.º 2
0
        private void AddPlayNextMatchDayForm(GameInfo gameInfo, Resource halDocument, DateTime matchDate)
        {
            var seasonService = ServiceFactory.CreateSeasonService(gameInfo);
            var matchService  = ServiceFactory.CreateMatchService(gameInfo);

            var currentSeason = seasonService.GetCurrentSeason();
            var nextMatchDate = matchService.GetNextMatchDate(currentSeason.Id);

            if (nextMatchDate.HasValue && matchDate == nextMatchDate)
            {
                // Add a form to play the match day.
                var matchDayResourceFactory = new MatchDayResourceFactory(UriHelper, gameInfo.Id, nextMatchDate.Value);
                var form = matchDayResourceFactory.GetForm();
                halDocument.AddForm(form);

                // Also add a link to the match day.
                var link = matchDayResourceFactory.GetLink();
                halDocument.AddLink("rel:next-match-day", link);
            }
        }