public paginacao <ExameDTO> List( int skip, int top, bool count, bool?soinativos = null, string pesquisa = null ) { int?nCount = null; var exames = repository.List(); if (soinativos == true) { exames = exames.Where(a => a.inativo != null); } else { exames = exames.Where(a => a.inativo == null); } if (pesquisa != null) { exames = exames.Where(a => a.idexterno.ToUpper().Contains(pesquisa.ToUpper()) || a.idpacienteNavigation.nome.ToUpper().Contains(pesquisa.ToUpper())); } if (count) { nCount = exames.Count(); } if (skip < 0) { skip = 0; } exames = exames.OrderBy(a => a.idexterno); exames = exames.Skip(skip).Take(top); return(new paginacao <ExameDTO>() { values = exames.ProjectTo <ExameDTO>(mapper.ConfigurationProvider).ToArray(), count = nCount }); }