/// <summary> /// 获得数据列表 /// </summary> public List <SmartTeaching.Entity.Base_NewsType> DataTableToList(DataTable dt) { List <SmartTeaching.Entity.Base_NewsType> modelList = new List <SmartTeaching.Entity.Base_NewsType>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SmartTeaching.Entity.Base_NewsType model; for (int n = 0; n < rowsCount; n++) { model = new SmartTeaching.Entity.Base_NewsType(); if (dt.Rows[n]["NewsTypeId"].ToString() != "") { model.NewsTypeId = int.Parse(dt.Rows[n]["NewsTypeId"].ToString()); } model.NewsTypeName = dt.Rows[n]["NewsTypeName"].ToString(); model.Remarks = dt.Rows[n]["Remarks"].ToString(); if (dt.Rows[n]["ParentId"].ToString() != "") { model.ParentId = int.Parse(dt.Rows[n]["ParentId"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SmartTeaching.Entity.Base_NewsType model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SmartTeaching.Entity.Base_NewsType model) { return(dal.Add(model)); }