public IHttpActionResult GetParticipantAttendance(int course_id) { var user_id = APIUtils.GetUserFromClaim(ClaimsPrincipal.Current); var attendance = ParticipantHelper.GetParticipantAttendance(user_id, course_id); return(Ok(new ApiCallbackMessage(attendance.ToString(), true))); }
public UserParticipantVM(User user, Participant participant) { this.UserID = user.UserID; this.FirstName = user.FirstName; this.LastName = user.LastName; this.Email = user.Email; this.CourseID = participant.CourseID; this.AttendancePercentage = ParticipantHelper.GetParticipantAttendance(UserID, CourseID); }
// GET: Courses/SeeDetailedOverview/courseId&studentId // returns detailed overviev view for the specified student and targeted course public ActionResult SeeDetailedOverview(int courseId, int studentId) { Course course = CourseHelper.GetById(courseId); User student = UserHelper.GetById(studentId); if (course == null || student == null) { return(HttpNotFound()); } var isSupervisor = SupervisorHelper.IsUserSupervisor(CurrentWebContext.CurrentUser.UserID, courseId); if (!isSupervisor) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } ViewBag.AttendancePerformance = ParticipantHelper.GetParticipantAttendance(student.UserID, course.CourseID); var vm = DetailedOverviewForStudentVM.CreateDetailedOverviewForStudentVM(student, course); return(View(vm)); }