//[HttpPost] //[ValidateAntiForgeryToken] public IActionResult Detail(string courseId) { int _courseId = Convert.ToInt32(courseId); ActionResult result = null; int _role = 0; if (IsAuthenticated) { _role = CurrentUser.RoleId; if (_role == 2) { Course crs = _coursedb.GetCourse(_courseId); List <Curricula> currs = (List <Curricula>)_currDAL.GetCurriculas(_courseId); List <List <CurriculaLineItem> > allLines = new List <List <CurriculaLineItem> >(); CourseFullDataViewModel ccvm = new CourseFullDataViewModel() { FullDataUserId = CurrentUser.Id, DisplayUser = CurrentUser.FirstName, Id = crs.Id, EstimatedDuration = crs.EstimatedDuration, Description = crs.Description, Category = crs.CategoryName, MyCurricula = currs, TeacherFirstName = crs.TeacherFirstName, TeacherLastName = crs.TeacherLastName, TeacherId = crs.TeacherId, Name = crs.Name }; for (int i = 0; i < currs.Count; i++) { List <CurriculaLineItem> curlines = new List <CurriculaLineItem>(); curlines = (List <CurriculaLineItem>)_currDAL.GetCurriculaLineItems(ccvm.MyCurricula[i].Id); allLines.Add(curlines); } ccvm.MyCurriculaLineItems = allLines; result = View(ccvm); } else if (_role == 1) { result = RedirectToAction("Dashboard", "Teacher"); } } else { result = RedirectToAction("Login", "User"); } return(result); }