public async Task <IActionResult> EditPollConfirmed(RawPollViewModel model)
        {
            var poll = await PollContext.Polls.FindAsync(model.PollId);

            PollContext.Polls.Remove(poll);
            await CreatePollAsync(model);

            return(RedirectToAction("ListPolls"));
        }
        private async Task CreatePollAsync(RawPollViewModel vm)
        {
            var poll = new Poll
            {
                Question  = vm.Question,
                StartDate = vm.StartDate.ToUniversalTime(),
                EndDate   = vm.EndDate.ToUniversalTime(),
            };

            poll.Choices = new ChoiceConverter(poll).GetChoices(vm.Choices);

            PollContext.Polls.Add(poll);
            await PollContext.SaveChangesAsync();
        }
        public async Task <IActionResult> CreatePollConfirmed(RawPollViewModel vm)
        {
            await CreatePollAsync(vm);

            return(RedirectToAction("ListNewPolls", "Poll"));
        }