Beispiel #1
0
        public async Task <PollFlexibleModel> PopulatePollName(int id)
        {
            PollFlexibleModel model = new PollFlexibleModel();

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

            return(model);
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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 }));
        }
Beispiel #6
0
        public async Task <IActionResult> Display(int id)
        {
            PollFlexibleModel displayModel = await _modelPopulator.PopulatePollAndOptionsForDisplay(id);

            return(View(displayModel));
        }