コード例 #1
0
        public async Task <IActionResult> GetById(int id)
        {
            AssignmentWithConcrete assignment =
                await _assignmentService.GetAssignmentById(id, _userService.UserId, x => x.Subject,
                                                           x => x.Attachments);

            if (assignment == null)
            {
                return(NotFound());
            }
            if (!await _assignmentService.CheckUserAsync(assignment.Assignment, _userService.UserId))
            {
                return(Forbid());
            }

            return(Ok(_mapper.Map <AssignmentDetailsDtoStudent>(assignment)));
        }