public IActionResult Index(int id) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Intro")); } TestOfSetsViewModel model = new TestOfSetsViewModel(); model.user = _userManager.GetBy(User.Identity.Name, User.Identity.Name); model.course = _courseServices.GetBy(id); model.question = _courseServices.GetVocabulary(id); ViewData["Page.Title"] = model.name; ViewData["Page.Target"] = "Học phần"; return(View(model)); }
public IActionResult Sets(string id) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Intro")); } if (id == null || (!_userManager.IsActive(id) && !_userManager.IsAdmin(User.Identity.Name))) { id = User.Identity.Name; } UserViewModel model = new UserViewModel(); model.user = _userManager.GetBy(User.Identity.Name, User.Identity.Name); model.owner = _userManager.GetBy(id); model.owner.CourseCount = _courseServices.CourseCount(id); model.owner.FolderCount = _folderServices.FolderCount(id); model.owner.ClassCount = _classServices.ClassCount(id); model.setList = new List <SetsViewModel>(); foreach (var course in _courseServices.GetCoureList(id)) { SetsViewModel temp = new SetsViewModel(); temp.ID = course.ID; temp.Name = course.name; temp.count = _courseServices.GetVocabulary(course.ID).Count(); model.setList.Add(temp); } ViewData["Page.Title"] = model.user.ID; ViewData["Page.Target"] = "Học phần"; return(View(model)); }