コード例 #1
0
        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)));
        }
コード例 #2
0
 public GetAcademicSubjectsViewModel()
 {
     Input = new GetAcademicSubjectsInput();
     Value = new ListResultDto <AcademicSubjectItemDto>();
 }