示例#1
0
        public ActionResult Planning(string studentId)
        {
            if (studentId == null || studentId.Length == 0)
            {
                studentId = User.Identity.GetUserId();
            }

            if (usersRepo.GetUserRole(studentId).Name == RoleConstants.Student)
            {
                User user = usersRepo.UserById(studentId);

                List <Schedule> schedules = schedRepo.StudentSchedules(studentId).ToList();

                return(View(new UsersScheduleVM
                {
                    UserFullName = user.ToString(),
                    Schedules = schedules,
                    ShowDocumentsLink = user.Id == User.Identity.GetUserId(),
                    ShowSchedulesLink = User.IsInRole(RoleConstants.Admin)
                }));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }