Beispiel #1
0
        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));
        }
Beispiel #3
0
        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));
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        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));
        }