public async Task <Result <ListResultDto <AcademicSubjectItemDto> > > GetAcademicSubjects(GetAcademicSubjectsInput input) { var query = _academicSubjectRepository.GetAllIncluding( acadSubj => acadSubj.StudyGroupAcademicSubjects); var academicSubjects = await query.ToListAsync(); if (input.StudyGroupId.HasValue) { academicSubjects = academicSubjects.Where(acadSubj => acadSubj.StudyGroupAcademicSubjects.Any( prop => prop.StudyGroupId == input.StudyGroupId)).ToList(); } var academicSubjectDtos = new List <AcademicSubjectItemDto>(); foreach (var academicSubject in academicSubjects) { var academicSubjectDto = await MapEntityToEntityDto(academicSubject); academicSubjectDtos.Add(academicSubjectDto); } return(Result <ListResultDto <AcademicSubjectItemDto> > .Success( new ListResultDto <AcademicSubjectItemDto>(academicSubjectDtos))); }
public GetAcademicSubjectsViewModel() { Input = new GetAcademicSubjectsInput(); Value = new ListResultDto <AcademicSubjectItemDto>(); }