public ActionResult ShowTestsByTheme(int?categoryId)
        {
            var tests = testService.GetAllByPredicate(t => t.ThemeId == categoryId);

            if (tests == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var mvcTests = tests.Select(t => t.ToMvcAllTests());

            ViewBag.ThemeName = themeService.GetById(Convert.ToInt32(categoryId)).Name;
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ShowTestsByTheme", mvcTests));
            }
            return(View("_ShowTestsByTheme", mvcTests));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetById(int id)
        {
            var dto = await _themeService.GetById(id);

            if (dto == null)
            {
                return(NotFound());
            }

            return(Ok(dto));
        }
        public IActionResult Delete(int id)
        {
            ThemeVM theme = _themeService.GetById(id);

            if (theme == null)
            {
                return(NotFound());
            }

            _themeService.Delete(theme.ThemeId);

            return(Ok(theme));
        }
Exemplo n.º 4
0
 public async Task <ActionResponse <ThemeDto> > GetById(SimpleRequestBase request)
 {
     return(await themeService.GetById(request.Id));
 }
        public IActionResult Details(int id)
        {
            ThemeVM theme = _themeService.GetById(id);

            return(View(theme));
        }