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