public async Task <ActionResult> Index(Guid themeId, int page = 1, int pageSize = 10) { var questions = await _questionAdminService.GetAllQuestionsByThemeIdAsync(page, pageSize, themeId); var theme = await _themeAdminService.GetThemeByIdAsync(themeId); List <Breadcrumb> breadcrumb = new List <Breadcrumb>() { new Breadcrumb("Home", "Index", "Home", new { Area = "" }), new Breadcrumb("Subjects", "Index", "Subject", new { Area = "Admin" }), new Breadcrumb("Subject themes", "Index", "Theme", new { Area = "Admin", subjectId = theme.SubjectId }), new Breadcrumb("Questions of the theme") }; QuestionIndexViewModel questionIndexViewModel = new QuestionIndexViewModel { PageInfo = questions, ThemeId = themeId, Questions = questions.Results, Breadcrumb = breadcrumb }; ViewBag.Title = $"List of questions to the theme \"{theme.Title}\" of the subject \"{theme.SubjectTitle}\""; ViewBag.HeadFirstTitle = $"List of questions to the theme \"{theme.Title}\""; ViewBag.HeadSecondTitle = $"Subject \"{theme.SubjectTitle}\""; return(View(questionIndexViewModel)); }
public ActionResult Index() { if (this.ModelState.IsValid) { var questions = this.questions.AllApprovedQuestions().To<AllQuestionsViewModel>().ToList(); var viewModel = new QuestionIndexViewModel { Questions = questions }; return this.View(viewModel); } return this.View(); }
public ActionResult Index() { if (this.ModelState.IsValid) { var questions = this.questions.AllApprovedQuestions().To <AllQuestionsViewModel>().ToList(); var viewModel = new QuestionIndexViewModel { Questions = questions }; return(this.View(viewModel)); } return(this.View()); }
public ActionResult QuestionIndex(int id) { if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var questions = QuizService.QuestionListByQuizId(id); var model = new QuestionIndexViewModel() { QuestionList = questions, QuizId = id }; return(View(model)); }
public ActionResult QuestionIndex(int?ID) { if (ID != null) { TestPreview test = TestRepository.Tests.First(x => x.Id == ID); QuestionIndexViewModel questions = new QuestionIndexViewModel(); questions.Questions = QuestionRepository.Question.Where(x => x.TestID == ID); questions.TestID = test.Id; return(View(questions)); } else { QuestionIndexViewModel questions = new QuestionIndexViewModel(); questions.Questions = QuestionRepository.Question; return(View(questions)); } }
public ActionResult QuestionDelete(int id) { if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var question = QuizService.GetQuestionById(id); var questions = QuizService.QuestionListByQuizId(question.QuizId); var model = new QuestionIndexViewModel() { QuestionId = id, QuizId = question.QuizId, QuestionList = questions, Description = question.Description }; return(View(model)); }