Esempio n. 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)));
        }
Esempio n. 2
0
        /// <summary>
        /// Get an assignment by Id.
        /// </summary>
        public IHttpActionResult Get(int id)
        {
            AssignmentService assignmentService = CreateAssignmentService();
            var assignments = assignmentService.GetAssignmentById(id);

            string newLog     = "Assignment Recieved By Id";
            var    logService = CreateLogService();

            logService.LogCreate(newLog);

            return(Ok(assignments));
        }