public ActionResult Student() { if (!UserIsInRole("Student")) { return(RedirectToAction("Index", "Home")); } var enrollment = _enrollmentQuery.Handle(new EnrollmentInputGetByStudent { StudentId = Authentication.UserId }).Enrollment; ViewBag.Disciplines = _disciplineEvaluationQuery.Handle(new DisciplineInputListByEnrollment { EnrollmentId = enrollment.Id, StudentId = Authentication.UserId, SemesterBegin = enrollment.Begin, SemesterEnd = enrollment.End }).Disciplines; ViewBag.StatusEnrollment = enrollment.Status; var enrollments = _enrollmentQuery.Handle(new EnrollmentInputListByStudent { StudentId = Authentication.UserId }).Enrollment.OrderBy(x => x.Begin).ToList(); enrollments.RemoveAll(x => x.Id == enrollment.Id); ViewBag.Enrollments = enrollments; return(View()); }
// GET: Grade public ActionResult Index(Guid?enrollmentId) { if (!UserIsInRole("Student")) { return(RedirectToAction("Index", "Home")); } Enrollment enrollment; if (enrollmentId == null) { enrollment = _enrollmentQuery.Handle(new EnrollmentInputGetByStudent { StudentId = Authentication.UserId }).Enrollment; } else { enrollment = _enrollmentQuery.Handle(new EnrollmentInputGet { EnrollmentId = (Guid)enrollmentId }).Enrollment; } var disciplines = _disciplineQuery.Handle(new DisciplineInputListByEnrollment { EnrollmentId = enrollment.Id, StudentId = Authentication.UserId, SemesterBegin = enrollment.Begin, SemesterEnd = enrollment.End }).Disciplines; var grades = new GradeListViewModel() { EnrollmentId = (Guid)enrollment.Id }; grades.Students = disciplines.Select(x => new GradeListItem { Grade = x.Activities.Sum(y => y.Grade), FinalExam = x.FinalExamGrade, Discipline = x.Name, DisciplineId = x.Id, Status = DictionaryStudentStatus.Get(x.StudentStatus, out string color), StatusColor = color });
public ActionResult Index() { if (!UserIsInRole("Admin")) { return(RedirectToAction("Index", "Home")); } var result = _enrollmentQuery.Handle(new EnrollmentInputGetPreEnrollments()).Enrollment; var enrollments = new EnrollmentListViewModel { Students = result.Select(x => new EnrollmentListItem { Id = x.Id, Student = x.Student.Name }) }; return(View(enrollments)); }