public async Task <IActionResult> Add(LessonDto lessonDto) { Subject subject = await _db.Subjects.FindAsync(lessonDto.SubjectId); if (subject.TeacherId != _userService.UserId) { return(Forbid()); } Lesson lesson = await _lessonService.AddAsync(lessonDto); return(CreatedAtAction(nameof(GetById), new { id = lesson.Id }, _mapper.Map <LessonDto>(lesson))); }