示例#1
0
        public async Task <ActionResult <IEnumerable <ProfessionDto> > > GetProfessions([FromQuery] ProfessionDtoParameters professionDtoParameters)
        {
            var professions = await _professionRepository.GetProfessionsAsync(professionDtoParameters);

            //添加导航属性
            foreach (var professin in professions)
            {
                professin.Academy = await _academyRepository.GetAcademyAsync(professin.AcademyId);
            }
            var professionDtos = _mapper.Map <IEnumerable <ProfessionDto> >(professions);

            return(Ok(professionDtos));
        }