/// <summary> /// 获得数据列表 /// </summary> public List <dbamet.Model.Intro> DataTableToList(DataTable dt) { List <dbamet.Model.Intro> modelList = new List <dbamet.Model.Intro>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { dbamet.Model.Intro model; for (int n = 0; n < rowsCount; n++) { model = new dbamet.Model.Intro(); if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["type"] != null && dt.Rows[n]["type"].ToString() != "") { model.type = dt.Rows[n]["type"].ToString(); } if (dt.Rows[n]["title"] != null && dt.Rows[n]["title"].ToString() != "") { model.title = dt.Rows[n]["title"].ToString(); } if (dt.Rows[n]["introcontent"] != null && dt.Rows[n]["introcontent"].ToString() != "") { model.introcontent = dt.Rows[n]["introcontent"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(dbamet.Model.Intro model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(dbamet.Model.Intro model) { return(dal.Add(model)); }