/// <summary>
        ///     Gets all themes from repository
        /// </summary>
        /// <returns>returns the list of all themes</returns>
        public List <Theme> GetAllThemes()
        {
            var themes = _themeRepository.GetAllThemes();

            foreach (var theme in themes)
            {
                theme.CourseCount = _courseService.GetCoursesByTheme(theme.ThemeId).Count();
            }
            return(themes);
        }
 public JsonResult Get()
 {
     try
     {
         var result = Mapper.Map <IEnumerable <ThemeViewModel> >(_repository.GetAllThemes());
         return(new JsonResult(result));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         return(Json(new { ex.Message }));
     }
 }
 public IEnumerable <Theme> GetAllThemes()
 {
     return(_themeRepository.GetAllThemes());
 }
Beispiel #4
0
 public async Task <Theme[]> GetAllThemes() => await themeRepository.GetAllThemes();
Beispiel #5
0
 public IActionResult Index(int?forumId)
 {
     return(View(_repository.GetAllThemes(forumId)));
 }