/// <summary> /// 获得数据列表 /// </summary> public List <BookShop.Model.Publisher> DataTableToList(DataTable dt) { List <BookShop.Model.Publisher> modelList = new List <BookShop.Model.Publisher>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { BookShop.Model.Publisher model; for (int n = 0; n < rowsCount; n++) { model = new BookShop.Model.Publisher(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Name = dt.Rows[n]["Name"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BookShop.Model.Publisher model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BookShop.Model.Publisher model) { return(dal.Add(model)); }