public ActionResult Add() { var addCourseViewModel = new AddCourseViewModel(); var teacherListView = new List <SelectListItem>(); var teachers = _userService.GetAllTeachers(); foreach (var teacher in teachers) { teacherListView.Add(new SelectListItem { Value = teacher.Email, Text = teacher.Name }); } addCourseViewModel.Teachers = new SelectList(teacherListView, "Value", "Text"); var themes = _themeService.GetAllThemes(); var themeListView = new List <SelectListItem>(); foreach (var theme in themes) { themeListView.Add(new SelectListItem { Value = theme.ThemeId.ToString(), Text = theme.Name }); } addCourseViewModel.Teachers = new SelectList(teacherListView, "Value", "Text"); addCourseViewModel.Themes = new SelectList(themeListView, "Value", "Text"); addCourseViewModel.Start = DateTime.Today; addCourseViewModel.end = DateTime.Today; return(View(addCourseViewModel)); }
public IActionResult GetAllThemes() { try { List <ThemeModel> themes = _themeService.GetAllThemes(); return(PartialView("_AllThemes", themes)); } catch (Exception e) { return(StatusCode(500, e)); } }
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)); }
public List <string> GetThemeNames() { List <string> list = new List <string>(); var themes = _theme.GetAllThemes(); if (themes != null && themes.Count() > 0) { foreach (var item in themes) { string path = _env.MapWebRootPath(_themeName, item.ID); if (ExtFile.ExistDirectory(path)) { list.Add(item.ID); } } } return(list); }
public virtual List <string> GetThemeNames() { List <string> list = new List <string>(); var themes = _themeService.GetAllThemes(); if (themes != null && themes.Count() > 0) { foreach (var item in themes) { string path = _webHostEnvironment.MapWebRootPath(_themeFolderName, item.ID); if (ExtFile.ExistDirectory(path)) { list.Add(item.ID); } } } return(list); }
public void GetAllThemesTest() { var expected = new List <Theme>() { new Theme(1, "Science", 1), new Theme(2, "IT", 1), new Theme(3, "Language", 0) }; var res = _themeService.GetAllThemes(); Assert.AreEqual(expected.Count, res.Count); res.OrderBy(x => x.ThemeId); expected.OrderBy(x => x.ThemeId); for (int i = 0; i < expected.Count; ++i) { Assert.AreEqual(expected[i].Name, res[i].Name); } }
// // GET: /Admin/Themes/ public ActionResult Index() { IEnumerable <Theme> themes = _themeService.GetAllThemes(); List <ThemeModel> models = new List <ThemeModel>(); ThemeConfiguration themeConfig; foreach (Theme theme in themes) { themeConfig = _themeProvider.GetThemeConfiguration(theme.ThemeName); if (themeConfig != null) { models.Add(new ThemeModel() { VirtualPath = themeConfig.VirtualPath, ThemeName = theme.ThemeName, ThemeType = theme.ThemeType, ThemeTitle = themeConfig.ThemeTitle, Modified = theme.Modified }); } } return(View(models)); }
public async Task <IActionResult> Index() => View((await themeService.GetAllThemes()).Select(theme => new ThemeListViewModel(theme)).ToList());
public async Task <ActionResult> Index() { var themes = Mapper.Map <IEnumerable <DTOThemeViewModel>, IEnumerable <ThemeViewModel> >(ThemeService.GetAllThemes()); if (!Request.IsAjaxRequest()) { return(View(themes)); } else { if (Request.IsAuthenticated) { await UpdateUsers(); } return(PartialView("_ThemePartial", themes)); } }