示例#1
0
        public async Task <List <SubjectGroupDTO> > List([FromBody] SubjectGroupFilterDTO subjectGroupFilterDTO)
        {
            SubjectGroupFilter filter = new SubjectGroupFilter
            {
                Code = new StringFilter {
                    StartsWith = subjectGroupFilterDTO.Code
                },
                Name = new StringFilter {
                    Contains = subjectGroupFilterDTO.Name
                },
                Skip      = subjectGroupFilterDTO.Skip,
                Take      = int.MaxValue,
                OrderBy   = SubjectGroupOrder.Code,
                OrderType = OrderType.ASC
            };

            List <SubjectGroup> subjectGroups = await SubjectGrupService.List(filter);

            List <SubjectGroupDTO> subjectGroupDTOs = subjectGroups.Select(s => new SubjectGroupDTO
            {
                Id   = s.Id,
                Code = s.Code,
                Name = s.Name
            }).ToList();

            return(subjectGroupDTOs);
        }
示例#2
0
        public async Task <List <SubjectGroupDTO> > List([FromBody] SubjectGroupFilterDTO subjectGroupFilterDTO)
        {
            SubjectGroupFilter filter = new SubjectGroupFilter
            {
                Code      = subjectGroupFilterDTO.Code,
                Name      = subjectGroupFilterDTO.Name,
                Skip      = subjectGroupFilterDTO.Skip,
                Take      = subjectGroupFilterDTO.Take,
                OrderBy   = subjectGroupFilterDTO.OrderBy,
                OrderType = subjectGroupFilterDTO.OrderType
            };

            List <SubjectGroup> subjectGroups = await SubjectGrupService.List(filter);

            List <SubjectGroupDTO> subjectGroupDTOs = subjectGroups.Select(s => new SubjectGroupDTO(s)).ToList();

            return(subjectGroupDTOs);
        }