public List <Chain.Model.ProductClass> DataTableToList(DataTable dt) { List <Chain.Model.ProductClass> modelList = new List <Chain.Model.ProductClass>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.ProductClass model = new Chain.Model.ProductClass(); if (dt.Rows[i]["ClassID"] != null && dt.Rows[i]["ClassID"].ToString() != "") { model.ClassID = int.Parse(dt.Rows[i]["ClassID"].ToString()); } if (dt.Rows[i]["ClassName"] != null && dt.Rows[i]["ClassName"].ToString() != "") { model.ClassName = dt.Rows[i]["ClassName"].ToString(); } if (dt.Rows[i]["ClassRemark"] != null && dt.Rows[i]["ClassRemark"].ToString() != "") { model.ClassRemark = dt.Rows[i]["ClassRemark"].ToString(); } modelList.Add(model); } } return(modelList); }
public bool Update(Chain.Model.ProductClass model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.ProductClass model) { return(this.dal.Add(model)); }