public Task <PagedResult <ProductDto> > GetPaged(string name, string orderBy, bool orderAsc, int page, int pageSize) { var data = _readOnlyService.Repository <Entities.Product>().GetPaged(i => string.IsNullOrEmpty(name) || i.Name.ToLower().Contains(name.ToLower()), orderBy, orderAsc, page: page, pageSize: pageSize); var result = new PagedResult <ProductDto> { CurrentPage = data.CurrentPage, PageCount = data.PageCount, PageSize = data.PageSize, RowCount = data.RowCount, Results = ProductMapper.EntityToDtos(data.Results) }; return(Task.FromResult(result)); }