public async Task <ActionResult <IEnumerable <LessonWithSubjectDto> > > GetTimetableAsync(string studentId) { // Todo optimize time of request if (!_repository.StudentExists(studentId)) { return(NotFound()); } var lessonsEntities = await _repository.GetLessonsWithSubjectsForStudentAsync(studentId); var lessonDtos = lessonsEntities.Select(l => _mapper.Map <LessonWithSubjectDto>(l)); return(Ok(lessonDtos.OrderBy(l => l.Week) .ThenBy(l => l.DayOfWeek) .ThenBy(l => l.TimeStart))); }