예제 #1
0
        //[PageRemote(
        //    ErrorMessage = "Plese select a word that is NOT found in the text below",
        //    AdditionalFields = "__RequestVerificationToken",
        //    HttpMethod = "post",
        //    PageHandler = "CheckGuideWord"
        //)]
        //[BindProperty]
        //public string UserGuideWord { get; set; }

        public async Task <IActionResult> OnGetAsync(int GroupId, int TeamId, string Message)
        {
            try
            {
                Group = await _context.GameGroups.Include(g => g.GameTeams).Where(g => g.Id == GroupId).SingleAsync();
            }
            catch
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find that Group" }));
            }
            try { Team = Group.GameTeams.Single(t => t.Id == TeamId); }
            catch { return(RedirectToPage("/error", new { errorMessage = "That's Odd! We were not able to find that Team" })); }

            string BibleId = await GameTeam.GetValidBibleIdAsync(_context, null);

            Path = await _context.Paths.FindAsync(Group.PathId);

            if (Path == null)
            {
                return(RedirectToPage("/error", new { errorMessage = "That's Very Odd! We were not able to find the Path for this Group" }));
            }

            CurrentStep = await _context.PathNodes.FindAsync(Team.CurrentStepId);

            _ = await CurrentStep.AddGenericStepPropertiesAsync(_context, BibleId);

            _ = await CurrentStep.AddPathStepPropertiesAsync(_context);

            CurrentStep.Verses = await CurrentStep.GetBibleVersesAsync(_context, BibleId, true, false);

            // Now let's add VerseText to our Step
            _ = CurrentStep.AddVerseText();

            ViewData["KeyWordSelectList"] = await Team.GetKeyWordSelectListAsync(_context, CurrentStep);

            if (Team.BoardState == (int)GameTeam.GameBoardState.WordSelectOffPath)
            {
                Message = "Your Team seems to have fallen off the path, try to get them back on";
            }

            UserMessage = GetUserMessage(Message);
            return(Page());
        }