I want to bring only some fields of what the consultation brings me,
var result = dbContext.Cliente.Include("Contacto.Cliente").ToList();
this brings me the following:
"Objects": [
{
"IdCliente": 3,
"Identificacion": 10,
"Nombre": "Ebony Kemp",
"Direccion": "855-3865 Ipsum Street",
"Telefono": "1626010138799",
"Estado": true,
"FechaCreacion": "2012-06-18T10:34:09",
"FechaModificacion": "2012-06-18T10:34:09",
"UsuarioCreacion": "7a4f4875-0c70-fa98-b29b-331ff027fd67",
"UsuarioModificacion": "44a1e2b1-2be6-fad2-84e1-6eb3cec55cc0",
"Contacto": [
{
"IdContacto": 2,
"Nombres": "juan",
"Apellidos": "hincapie",
"Direccion": null,
"Telefono": "555555",
"Email": null,
"Estado": true,
"IdCliente": 3,
"IdTipoContacto": 1,
"FechaCreacion": null,
"FechaModificacion": null,
"UsuarioCreacion": null,
"UsuarioModificacion": null
}
]
},
But I want you to just return me: Client: Identification and Name Contact: Names but only those that are true and have the IdTypeContact : 1 (The ContactType is related to a ContactType table),
Additionally, I would have to return a list of type Client (not anonymous)
Could you help me in how to bring only those data with the best possible practice? Thanks!