I am working on n-layers asp.net mvc 4 c # web and I want to list an SP that contains inner join and that is listed when an ID is sent . the topic esque to list I do it in the following way in my DAL:
public List<Solicitudes> ListarSolicitudes()
{
var solicitudes = new List<Solicitudes>();
try
{
con.Open();
var query = new SqlCommand("select * from solicitudes", con);
using (var dr = query.ExecuteReader())
{
while (dr.Read())
{
Solicitudes objSolicitud = new Solicitudes();
objSolicitud.SolicitudesID = Convert.ToInt32(dr[0].ToString());
objSolicitud.FechaEmision = Convert.ToDateTime(dr[1].ToString());
objSolicitud.Observacion = dr[4].ToString();
solicitudes.Add(objSolicitud);
}
}
con.Close();
}
catch (Exception)
{
throw;
}
return solicitudes;
}
my problem is that to list I need a model like:
Solicitudes objSolicitud = new Solicitudes();
but being SP with inner join, some attributes of several models are required, I have read in forums that I have to make a generic list but I do not know how to do that, if you could help me please.