public List <Chain.Model.Photo> DataTableToList(DataTable dt) { List <Chain.Model.Photo> modelList = new List <Chain.Model.Photo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.Photo model = new Chain.Model.Photo(); if (dt.Rows[i]["PhotoID"] != null && dt.Rows[i]["PhotoID"].ToString() != "") { model.PhotoID = int.Parse(dt.Rows[i]["PhotoID"].ToString()); } if (dt.Rows[i]["PhotoName"] != null && dt.Rows[i]["PhotoName"].ToString() != "") { model.PhotoName = dt.Rows[i]["PhotoName"].ToString(); } if (dt.Rows[i]["PhotoPhoto"] != null && dt.Rows[i]["PhotoPhoto"].ToString() != "") { model.PhotoPhoto = dt.Rows[i]["PhotoPhoto"].ToString(); } if (dt.Rows[i]["PhotoDesc"] != null && dt.Rows[i]["PhotoDesc"].ToString() != "") { model.PhotoDesc = dt.Rows[i]["PhotoDesc"].ToString(); } if (dt.Rows[i]["PhotoCreateTime"] != null && dt.Rows[i]["PhotoCreateTime"].ToString() != "") { model.PhotoCreateTime = DateTime.Parse(dt.Rows[i]["PhotoCreateTime"].ToString()); } modelList.Add(model); } } return(modelList); }
public bool Update(Chain.Model.Photo model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.Photo model) { return(this.dal.Add(model)); }