Exemple #1
0
        public async Task <IActionResult> DisplayForm([FromRoute] int id)
        {
            var request = new GetPoll {
                Id = id
            };
            var model = await _mediator.Send(request);

            return(View("Form", model));
        }
Exemple #2
0
        public async Task <IActionResult> Details([FromRoute] int id)
        {
            var request = new GetPoll {
                Id = id
            };
            var poll = await _mediator.Send(request);

            var model = new DetailsViewModel
            {
                Poll          = poll,
                QuestionCount = poll.Questions.Count()
            };

            return(View(model));
        }
Exemple #3
0
        public async Task <IActionResult> GetPollToEdit(int id)
        {
            var request = new GetPoll {
                Id = id
            };
            var poll = await _mediator.Send(request);

            return(Ok(new
            {
                pollId = poll.Id,
                title = poll.Title,
                description = poll.Description,
                questions = poll.Questions.OrderBy(x => x.Number)
            }));;
        }