public async Task <ActionResult <EditPollViewModel> > GetEditPollViewModel(long id, string zoekterm) { EditPollViewModel editPollVM = new EditPollViewModel(); Poll poll = await _context.Polls.Where(p => p.PollID == id) .Include(p => p.PollGebruikers) .ThenInclude(p => p.Gebruiker) .Include(p => p.PollOpties) .FirstOrDefaultAsync(); editPollVM.EditPoll = poll; return(editPollVM); }
public IActionResult EditPoll(EditPollViewModel model) { try { var poll = _mapper.Map <Poll>(model); _pollsRepository.UpdatePoll(model.Id, model.QuestionText, model.IsCurrent); _unitOfWork.Commit(); return(View(nameof(this.ManagePolls))); } catch { return(View()); } }