Exemplo n.º 1
0
        public List <Chain.Model.Album> DataTableToList(DataTable dt)
        {
            List <Chain.Model.Album> modelList = new List <Chain.Model.Album>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.Album model = new Chain.Model.Album();
                    if (dt.Rows[i]["AlbumID"] != null && dt.Rows[i]["AlbumID"].ToString() != "")
                    {
                        model.AlbumID = int.Parse(dt.Rows[i]["AlbumID"].ToString());
                    }
                    if (dt.Rows[i]["AlbumName"] != null && dt.Rows[i]["AlbumName"].ToString() != "")
                    {
                        model.AlbumName = dt.Rows[i]["AlbumName"].ToString();
                    }
                    if (dt.Rows[i]["AlbumPhoto"] != null && dt.Rows[i]["AlbumPhoto"].ToString() != "")
                    {
                        model.AlbumPhoto = dt.Rows[i]["AlbumPhoto"].ToString();
                    }
                    if (dt.Rows[i]["AlbumDesc"] != null && dt.Rows[i]["AlbumDesc"].ToString() != "")
                    {
                        model.AlbumDesc = dt.Rows[i]["AlbumDesc"].ToString();
                    }
                    if (dt.Rows[i]["AlbumCreateTime"] != null && dt.Rows[i]["AlbumCreateTime"].ToString() != "")
                    {
                        model.AlbumCreateTime = DateTime.Parse(dt.Rows[i]["AlbumCreateTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 public bool Update(Chain.Model.Album model)
 {
     return(this.dal.Update(model));
 }
Exemplo n.º 3
0
 public int Add(Chain.Model.Album model)
 {
     return(this.dal.Add(model));
 }