public async Task <IEnumerable <RecursoHumanoDTO> > List(RecursoHumanoFilterDTO filter = null) { IEnumerable <RecursoHumano> entities; entities = await _recursoHumanoRepository.ListBy(recursohumano => ( (!filter.IdEmpresa.HasValue || recursohumano.IdEmpresa == filter.IdEmpresa.Value) && (!filter.CreationDateFrom.HasValue || recursohumano.CreationDate >= filter.CreationDateFrom.Value) && (!filter.CreationDateTo.HasValue || recursohumano.CreationDate <= filter.CreationDateTo.Value) && (filter.Nombre.IsNullOrEmpty() || recursohumano.Nombre.ToLower().Contains(filter.Nombre) || recursohumano.Cuil.ToLower().Contains(filter.Nombre) || recursohumano.Direccion.ToLower().Contains(filter.Nombre) || recursohumano.Email.ToLower().Contains(filter.Nombre) || recursohumano.Telefono.ToLower().Contains(filter.Nombre) || recursohumano.Apellido.ToLower().Contains(filter.Nombre) || // recursohumano.Multiservicio.Contains(filter.Nombre) || recursohumano.FechaNacimiento.ToString().Contains(filter.Nombre) || recursohumano.NroLegajo.ToLower().Contains(filter.Nombre)) ) && recursohumano.Active == true ); var dtos = _mapper.Map <IEnumerable <RecursoHumanoDTO> >(entities); return(dtos); }
public async Task <IActionResult> List(string name = null, DateTime?creationDateFrom = null, DateTime?creationDateTo = null, int?idEmpresa = null) { try { var filters = new RecursoHumanoFilterDTO(name, creationDateFrom, creationDateTo, this.Usuario.IdEmpresa); var entities = await _recursoHumanoService.List(filters); return(Ok(entities)); } catch (Exception e) { return(StatusCode(500, e)); } }