public IActionResult Index() { QuestionWrapperViewModel model = new QuestionWrapperViewModel(); model = _questionService.GetQuestionList(); return(View(model)); }
public QuestionWrapperViewModel GetQuestionList() { QuestionWrapperViewModel model = new QuestionWrapperViewModel(); List <QuestionViewModel> list = _questionRepository.GetAllQuestions(); model.QuestionList = list.Select(x => new QuestionViewModel { Id = x.Id, Question = x.Question, Option1 = x.Option1, Option2 = x.Option2, Option3 = x.Option3, Option4 = x.Option4, CorrectAnswer = x.CorrectAnswer, CreatedOn = x.CreatedOn, ModifiedOn = x.ModifiedOn, CreatedBy = x.CreatedBy }).ToList(); return(model); }