Hi everybody!!!
How do I Make a Master details like this; Person has income and credit history using WebAPI, part of my web api code in c# is....
public class PersonasController : ApiController
{
CreditosConexion context = new CreditosConexion();
[HttpGet]
public IEnumerable<Persona> Get()
{
return context.PersonaSet.AsEnumerable();
}
}
when I get the structure of Api / GET-api-People this is the result:
Collection of Persona
Name Description Type Additional information
PersonaID integer None.
TipoDocumento string None.
NumeroIdentificacion string None.
PrimerNombre string None.
SegundoNombre string None.
PrimerApellido string None.
SegundoApellido string None.
FechaNacimiento date None.
PersonasaCargo integer None.
Genero string None.
Credito Collection of Credito None.
IngresosPersona Collection of IngresosPersona None.
and the Response Formats
application/json, text/json
[
{
"PersonaID": 1,
"TipoDocumento": "sample string 2",
"NumeroIdentificacion": "sample string 3",
"PrimerNombre": "sample string 4",
"SegundoNombre": "sample string 5",
"PrimerApellido": "sample string 6",
"SegundoApellido": "sample string 7",
"FechaNacimiento": "2016-07-27T10:43:34.8845012-05:00",
"PersonasaCargo": 1,
"Genero": "sample string 8",
"Credito": [
{
"CreditoID": 1,
"PersonaID": 1,
"NumeroCuotas": 1,
"EstadoCredito": 1,
"MontoAprovado": 1.0,
"Plazo": 1,
"Tasa": 1.0,
"FechaCredito": "2016-07-27T10:43:34.8850014-05:00"
},
{
"CreditoID": 1,
"PersonaID": 1,
"NumeroCuotas": 1,
"EstadoCredito": 1,
"MontoAprovado": 1.0,
"Plazo": 1,
"Tasa": 1.0,
"FechaCredito": "2016-07-27T10:43:34.8850014-05:00"
}
],
"IngresosPersona": [
{
"IngresosPersonaId": 1,
"PersonaID": 1,
"SalarioBasico": 1.0,
"IngresosExtrasLaborables": 1.0,
"OtrosIngresosExtasNoLaborables": 1.0
},
{
"IngresosPersonaId": 1,
"PersonaID": 1,
"SalarioBasico": 1.0,
"IngresosExtrasLaborables": 1.0,
"OtrosIngresosExtasNoLaborables": 1.0
}
]
},
{
"PersonaID": 1,
"TipoDocumento": "sample string 2",
"NumeroIdentificacion": "sample string 3",
"PrimerNombre": "sample string 4",
"SegundoNombre": "sample string 5",
"PrimerApellido": "sample string 6",
"SegundoApellido": "sample string 7",
"FechaNacimiento": "2016-07-27T10:43:34.8845012-05:00",
"PersonasaCargo": 1,
"Genero": "sample string 8",
"Credito": [
{
"CreditoID": 1,
"PersonaID": 1,
"NumeroCuotas": 1,
"EstadoCredito": 1,
"MontoAprovado": 1.0,
"Plazo": 1,
"Tasa": 1.0,
"FechaCredito": "2016-07-27T10:43:34.8850014-05:00"
},
{
"CreditoID": 1,
"PersonaID": 1,
"NumeroCuotas": 1,
"EstadoCredito": 1,
"MontoAprovado": 1.0,
"Plazo": 1,
"Tasa": 1.0,
"FechaCredito": "2016-07-27T10:43:34.8850014-05:00"
}
],
"IngresosPersona": [
{
"IngresosPersonaId": 1,
"PersonaID": 1,
"SalarioBasico": 1.0,
"IngresosExtrasLaborables": 1.0,
"OtrosIngresosExtasNoLaborables": 1.0
},
{
"IngresosPersonaId": 1,
"PersonaID": 1,
"SalarioBasico": 1.0,
"IngresosExtrasLaborables": 1.0,
"OtrosIngresosExtasNoLaborables": 1.0
}
]
}
]
Angular cannot be used?, can I do it with just MVC?
If I'll use Angular how to make this?
What I have tried:
public class PersonasController : ApiController
{
CreditosConexion context = new CreditosConexion();
[HttpGet]
public IEnumerable<Persona> Get()
{
return context.PersonaSet.AsEnumerable();
}
}