public async Task<IActionResult> GetStatsById([FromRoute] Guid studentId, [FromQuery] Guid? academicYearId) { try { var student = await StudentService.GetById(studentId); if (await CanAccessPerson(student.PersonId)) { if (academicYearId == null || academicYearId == Guid.Empty) { academicYearId = (await _academicYearService.GetCurrentAcademicYear()).Id; } var studentStats = await StudentService.GetStatsById(studentId, academicYearId.Value); return Ok(studentStats); } return PermissionError(); } catch (Exception e) { return HandleException(e); } }
public async Task <IActionResult> GetByStudent([FromRoute] Guid studentId, [FromQuery] Guid?academicYearId) { try { var student = await StudentService.GetById(studentId); if (await CanAccessPerson(student.PersonId)) { if (academicYearId == null || academicYearId == Guid.Empty) { academicYearId = (await _academicYearService.GetCurrentAcademicYear(true)).Id; } var logNotes = await _logNoteService.GetByStudent(studentId, academicYearId.Value); var result = logNotes; return(Ok(result)); } return(Forbid()); } catch (Exception e) { return(HandleException(e)); } }
public async Task <IActionResult> GetByStudent([FromRoute] Guid studentId, [FromQuery] Guid?academicYearId) { try { var student = await StudentService.GetById(studentId); if (await CanAccessPerson(student.PersonId)) { var fromAcademicYearId = academicYearId ?? (await _academicYearService.GetCurrentAcademicYear(true)).Id.Value; var incidents = await _behaviourService.GetIncidentsByStudent(studentId, fromAcademicYearId); return(Ok(incidents.Select(x => x.ToListModel()))); } return(Forbid()); } catch (Exception e) { return(HandleException(e)); } }
public async Task <IActionResult> GetByStudent([FromRoute] Guid studentId, [FromQuery] Guid?academicYearId) { try { var student = await StudentService.GetById(studentId); if (await CanAccessPerson(student.PersonId)) { var fromAcademicYearId = academicYearId ?? (await _academicYearService.GetCurrentAcademicYear(true)).Id.Value; var achievements = await _behaviourService.GetAchievementsByStudent(studentId, fromAcademicYearId); return(Ok(achievements.Select(x => x.ToListModel()))); } return(PermissionError()); } catch (Exception e) { Console.WriteLine(e); throw; } }