Exemplo n.º 1
0
        public async Task <PollFlexibleModel> PopulatePollName(int id)
        {
            PollFlexibleModel model = new PollFlexibleModel();

            model.Poll = await _pollRoutine.GetBasicPoll(id);

            return(model);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SuccessVoting(int id)
        {
            PollFlexibleModel displayModel = await _modelPopulator.PopulatePollName(id);

            displayModel.RedirectingUrl = _urlGenerator.GetResultsPageUrl(id, Url, _httpContextAccessor);

            return(View(displayModel));
        }
Exemplo n.º 3
0
        public async Task <PollFlexibleModel> PopulatePollAndOptionsForDisplay(int pollId)
        {
            PollFlexibleModel model = new PollFlexibleModel();

            model.Poll = await _pollRoutine.GetBasicPoll(pollId);

            model.Options = await _pollRoutine.GetPollOptionsForDisplay(pollId);

            return(model);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Done(PollFlexibleModel pollFullModel)
        {
            int id = pollFullModel.Poll.Id;

            PollFlexibleModel displayModel = await _modelPopulator.PopulatePollAndOptionsForDisplay(id);

            displayModel.RedirectingUrl = _urlGenerator.GetVotingPageUrl(id, Url, _httpContextAccessor);

            return(View(displayModel));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> AddOption(PollFlexibleModel pollFlexibleModel)
        {
            int id = pollFlexibleModel.Poll.Id;

            if (ModelState.IsValid == true)
            {
                bool haveRoomForNewOptions = await CheckForAvailableOptionSpace(id);

                if (haveRoomForNewOptions == true)
                {
                    await AddOneOptionToPoll(id, pollFlexibleModel.NewOption);
                }

                return(RedirectToAction("Display", new { id }));
            }

            return(RedirectToAction("Display", new { id }));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Display(int id)
        {
            PollFlexibleModel displayModel = await _modelPopulator.PopulatePollAndOptionsForDisplay(id);

            return(View(displayModel));
        }