public PagedList <Author> GetAuthors(Models.AuthorRequestDto authorRequestDto) { if (authorRequestDto is null) { throw new ArgumentNullException(nameof(authorRequestDto)); } var collection = _context.Authors as IQueryable <Author>; if (!string.IsNullOrWhiteSpace(authorRequestDto.SearchQuery)) { authorRequestDto.SearchQuery = authorRequestDto.SearchQuery.Trim(); collection = collection.Where(a => a.FirstName.Contains(authorRequestDto.SearchQuery) || a.LastName.Contains(authorRequestDto.SearchQuery)); } //if (!string.IsNullOrWhiteSpace(authorRequestDto.OrderBy)) //{ // var authorPropertyMappingDiccionary = _propertyMappingService.GetPropertyMapping<AuthorDto, Author>(); // collection = collection.ApplySort(authorRequestDto.OrderBy, authorPropertyMappingDiccionary); //} return(PagedList <Author> .Create(collection, authorRequestDto.PageNumber, authorRequestDto.PageSize)); }
public PagedList <Author> GetAuthors(Models.AuthorRequestDto authorRequestDto) { if (authorRequestDto is null) { throw new ArgumentNullException(nameof(authorRequestDto)); } return(_restApiRepository.GetAuthors(authorRequestDto)); }