Example #1
0
        public ActionResult List()
        {
            var themeList = new ThemeListViewModel();

            themeList.Themes = _themeService.GetAllThemes().Select(x => x.Map()).ToList();
            //foreach (var theme in themeListb)
            //{
            //    var count = _courseService.GetCoursesByTheme(theme.ThemeId).Count();
            //    themeList.Themes.Add(theme.Map(count));
            //}

            return(View(themeList));
        }
Example #2
0
        public ViewResult List(string name, int page = 1)
        {
            ThemeListViewModel model = new ThemeListViewModel
            {
                Themes = repository.Themes.Where(t => name == null || t.Name == name)
                         .OrderBy(t => t.ThemeId)
                         .Skip((page - 1) * PageSize)
                         .Take(PageSize),
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = name == null?
                                   repository.Themes.Count() :
                                       repository.Themes.Where(t => t.Name == name).Count()
                },
                ThemeName = name
            };

            return(View(model));
        }