public ActionResult CreateTest()
        {
            SelectList themes = new SelectList(themeService.GetAll(), "Id", "Name");

            ViewBag.Themes = themes;
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_CreateTest"));
            }
            return(View("_CreateTest"));
        }
Example #2
0
        public IActionResult Index()
        {
            IEnumerable <ThemeVM> themes = _themeService.GetAll();

            ViewBag.ThemeList = themes;

            return(View(new TestVM()));
        }
Example #3
0
        public IActionResult Index(string searchType = null, string name = null)
        {
            var homeVM = new HomeVM()
            {
                ThemeCount    = _themeService.GetAll().Count(),
                TestCount     = _testService.GetAll().Count(),
                QuestionCount = _questionService.GetAll().Count(),
                AnswerCount   = _answerService.GetAll().Count()
            };

            IEnumerable <ThemeVM> themes = null;

            if (name != null)
            {
                switch (searchType)
                {
                case "startWith":
                    themes = _themeService.GetAll().Where(x => x.Name.ToLower().StartsWith(name.ToLower()));
                    break;

                case "endWith":
                    themes = _themeService.GetAll().Where(x => x.Name.ToLower().EndsWith(name.ToLower()));
                    break;

                case "equal":
                    themes = _themeService.GetAll().Where(x => x.Name.ToLower().Equals(name.ToLower()));
                    break;

                case "contains":
                    themes = _themeService.GetAll().Where(x => x.Name.ToLower().Contains(name.ToLower()));
                    break;
                }
            }
            else
            {
                themes = _themeService.GetAll();
            }

            ViewBag.ThemeList = themes;

            return(View(homeVM));
        }
 public void Test2()
 {
     var     controller = new ApiThemeController(_themeService);
     ThemeVM theme      = _themeService.GetAll().FirstOrDefault(x => x.ThemeId == 1);
 }
Example #5
0
 public async Task <ActionResult <Theme[]> > Get(bool includeChildren = false)
 => await themeService.GetAll(includeChildren);
Example #6
0
 public async Task <ActionResponse <List <ThemeDto> > > GetAll()
 {
     return(await themeService.GetAll());
 }
 public IEnumerable <ThemeVM> GetThemes()
 {
     return(_themeService.GetAll());
 }