public async Task <PaginatedEnumerableDto <StudentDto> > ListAsync( int pageIndex, int pageSize, string sortBy = null, bool?ascending = false, int?id = null, string lastName = null, string firstMidName = null, DateTime?enrollmentStartDate = null, DateTime?enrollmentEndDate = null, List <int> enrollmentsId = null, string mail = null, int?age = null, bool?asNoTracking = null) { try { StudentSpecification specification = new StudentSpecification(pageIndex, pageSize, asNoTracking, sortBy, ascending) { Id = id, LastName = lastName, FirstMidName = firstMidName, EnrollmentStartDate = enrollmentStartDate, EnrollmentEndDate = enrollmentEndDate, EnrollmentsId = enrollmentsId, Mail = mail, Age = age, }; PaginatedEnumerable <Student> students = await _uow.StudentRepository.ListPaginatedAsync(specification); StudentDto sa = _mapper.Map <StudentDto>(students.Items.FirstOrDefault()); IEnumerable <StudentDto> s = _mapper.Map <IEnumerable <StudentDto> >(students.Items); PaginatedEnumerableDto <StudentDto> studentsDto = _mapper.Map <PaginatedEnumerableDto <StudentDto> >(students); return(studentsDto); } catch (AutoMapperMappingException ex) { throw; } catch (Exception ex) { throw; } }
public async Task <IActionResult> Get() { PaginatedEnumerableDto <StudentDto> students = await _studentManager.ListAsync(2, 3, "EnrollmentDate", true, null, null, null, null, null, null, null, null, true); return(Ok(students)); }