public List <Comentarios> GetComentarios(int id_platillo) { DataSet dsAll = View(VIEWS.vComentarios, "ID_PLATILLOS=" + id_platillo); List <Comentarios> r = new List <Comentarios>(); if (dsAll.Tables.Count == 0) { return(r); } foreach (DataRow row in dsAll.Tables[0].Rows) { Comentarios nc = new Comentarios(); nc.COMENTARIOS = Convert.ToString(row["COMENTARIOS"]); nc.ID_COMENTARIOS = Convert.ToInt32(row["ID_COMENTARIOS"]); nc.ID_PLATILLOS = Convert.ToInt32(row["ID_PLATILLOS"]); nc.ID_USUARIO = Convert.ToString(row["ID_USUARIO"]); nc.URL = Convert.ToString(row["URL"]); r.Add(nc); } return(r); }
public List <Comentarios> GetLastsComentarios() { DataSet dsAll = Select("select top 5 * from vComentarios order by ID_COMENTARIOS desc"); List <Comentarios> r = new List <Comentarios>(); if (dsAll.Tables.Count == 0) { return(r); } foreach (DataRow row in dsAll.Tables[0].Rows) { Comentarios nc = new Comentarios(); nc.COMENTARIOS = Convert.ToString(row["COMENTARIOS"]); nc.ID_COMENTARIOS = Convert.ToInt32(row["ID_COMENTARIOS"]); nc.ID_PLATILLOS = Convert.ToInt32(row["ID_PLATILLOS"]); nc.ID_USUARIO = Convert.ToString(row["ID_USUARIO"]); nc.URL = Convert.ToString(row["URL"]); nc.FECHA = Convert.ToString(row["FECHA"]); r.Add(nc); } return(r); }