/// <summary> /// 获得动态 /// </summary> /// <param name="id"></param> /// <param name="pageIndex"></param> /// <returns></returns> public List <Views.trends> GetTrends(string id, int pageIndex, string token = "") { List <Views.trends> trends = new List <Views.trends>(); Cook.DAL.course course = new DAL.course(); foreach (DataRow item in new Cook.DAL.users().GetTrends(id, pageIndex).Rows) { trends.Add(course.DataRowToTrends(item, token)); } return(trends); }
/// <summary> /// 获取最新trends /// </summary> /// <returns></returns> public List <Views.trends> GetNewTrends(int pageIndex, string token = "") { List <Views.trends> List = new List <Views.trends>(); DAL.course c = new DAL.course(); DataTable dt = c.GetListByPage(pageIndex, "", " time desc "); foreach (DataRow item in dt.Rows) { List.Add(c.DataRowToTrends(item, token)); } return(List); }
//我的收藏 public List <Views.trends> GetMyCollectbyid(string tableid) { //string tableid = new Cook.DAL.load().GetIdByToken(token); List <Views.trends> mycollect = new List <Views.trends>(); DAL.course course = new DAL.course(); DataTable dt = new DAL.collect_().getmycollect(tableid); foreach (DataRow itme in dt.Rows) { mycollect.Add(course.DataRowToTrends(itme)); } return(mycollect); }
//获取别人的教程 public List <Views.trends> GetMyCoursebyid(string type, string id, string token = "") { //string id = new Cook.DAL.load().GetIdByToken(token); List <Views.trends> List = new List <Views.trends>(); DAL.course c = new DAL.course(); DataTable dt = c.GetList(" authorid =" + id + " and type = " + type + " ", " time desc "); foreach (DataRow item in dt.Rows) { List.Add(c.DataRowToTrends(item, token)); } return(List); }