public async Task <IActionResult> All() { var quizViewModel = new IndexQuizViewModel() { Quizes = await this.quizService.GetAllQuizesAsync(), }; return(this.View(quizViewModel)); }
public async Task <IActionResult> AllQuizesPerCategory(int id) { var indexQuizModel = new IndexQuizViewModel() { Quizes = await this.categoriesService.GetQuizesPerCategoryIdAsync(id), }; return(this.View(indexQuizModel)); }
public async Task <IActionResult> MyQuizes(string id) { var userId = this.userManager.GetUserId(this.User); var quizViewModel = new IndexQuizViewModel() { Quizes = await this.quizService.GetAllQuizesByUserId(userId), }; return(this.View(quizViewModel)); }
public IActionResult Index(int page = 1) { if (page <= 0) { return(this.NotFound()); } IndexQuizViewModel model = new IndexQuizViewModel(); model.ElementsCount = this.quizzesService.GetQuizzesCount(); model.PageNumber = (int)page; model.Quizzes = this.quizzesService.GetQuizzes <DetailsQuizViewModel>((int)page, model.ItemsPerPage); return(this.View(model)); }
public async Task <IActionResult> SearchFor(string input) { if (string.IsNullOrEmpty(input) || string.IsNullOrWhiteSpace(input)) { return(this.View(null)); } var allQuizes = await this.quizService.GetAllQuizesWithNameAsync(input); var tagsResult = await this.quizService.GetAllQuizesWithTagAsync(input); var allTogother = tagsResult.ToList(); allTogother.AddRange(allQuizes); var quizViewModel = new IndexQuizViewModel() { Quizes = allTogother, }; return(this.View(quizViewModel)); }