예제 #1
0
        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);
            }
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
        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;
            }
        }