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

            if (usersRepo.GetUserRole(teacherId).Name == RoleConstants.Teacher)
            {
                User user = usersRepo.UserById(teacherId);

                List <Schedule> schedules = schedRepo.TeacherSchedules(teacherId).ToList();

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