public async Task <IActionResult> Add(AssignmentDetailsDto assignmentDto) { Subject subject = await _db.Subjects.FindAsync(assignmentDto.SubjectId); if (subject.TeacherId != _userService.UserId) { return(Forbid()); } Assignment assignment = await _assignmentService.AddAsync(assignmentDto, subject); await _db.SaveChangesAsync(); return(CreatedAtAction(nameof(GetById), new { assignment.Id }, _mapper.Map <AssignmentDetailsDto>(assignment))); }