Esempio n. 1
0
        public async Task <List <MajorsDTO> > List([FromBody] MajorsFilterDTO majorsFilterDTO)
        {
            MajorsFilter majorsFilter = new MajorsFilter
            {
                Code = new StringFilter {
                    StartsWith = majorsFilterDTO.Code
                },
                Name = new StringFilter {
                    Contains = majorsFilterDTO.Name
                },
                Skip      = majorsFilterDTO.Skip,
                Take      = int.MaxValue,
                OrderBy   = MajorsOrder.Name,
                OrderType = OrderType.ASC
            };

            List <Majors> universities = await MajorsService.List(majorsFilter);

            List <MajorsDTO> majorsDTOs = universities.Select(u => new MajorsDTO
            {
                Id   = u.Id,
                Code = u.Code,
                Name = u.Name
            }).ToList();

            return(majorsDTOs);
        }
Esempio n. 2
0
        public async Task <List <MajorsDTO> > List([FromBody] MajorsFilterDTO majorsFilterDTO)
        {
            MajorsFilter majorsFilter = new MajorsFilter
            {
                Code      = majorsFilterDTO.Code,
                Name      = majorsFilterDTO.Name,
                Skip      = majorsFilterDTO.Skip,
                Take      = majorsFilterDTO.Take,
                OrderBy   = majorsFilterDTO.OrderBy,
                OrderType = majorsFilterDTO.OrderType
            };

            List <Majors> universities = await MajorsService.List(majorsFilter);

            List <MajorsDTO> majorsDTOs = universities.Select(m => new MajorsDTO(m)).ToList();

            return(majorsDTOs);
        }