public async Task <ActionResult> Index() { //If admin if (AccountCredentials.GetRole() != RoleName.Lecturer) { var adminModel = new ReasignViewModel { Disciplines = await Context.Disciplines.ToListAsync(), Lectures = await Context.Lectures.ToListAsync(), Modules = await Context.Modules.ToListAsync(), Questions = await Context.Questions.ToListAsync(), Answers = await Context.Answers.ToListAsync(), Specialities = await Context.Specialities.ToListAsync(), Groups = await Context.Groups.ToListAsync(), Students = await Context.Students.ToListAsync(), Lectors = await Context.Lectors.ToListAsync() }; return(View(adminModel)); } //If lector Lector lector = await AccountCredentials.GetLector(); if (await Context.LecturesHistories.AnyAsync(lh => lh.IsFrozen == false && lh.LectorId == lector.Id && lh.EndTime == null)) { if (await Context.ModuleHistories.AnyAsync(mh => mh.StartTime != null && mh.IsPassed == false && mh.LectorId == lector.Id)) { return(RedirectToAction("modulestatistics", "quiz")); } return(RedirectToAction("activelecture", "admin")); } var checkIfLector = await _adminPageHelper.LecturesIndexPage(lector); return(View(checkIfLector)); }
public ActionResult RedirectToHome() { var role = AccountCredentials.GetRole(); if (role == RoleName.Student) { return(RedirectToAction("Index", "Student")); } return(RedirectToAction("Index", "Admin")); }