Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ROYcms.Blog.Model.ROYcms_blog> DataTableToList(DataTable dt)
        {
            List <ROYcms.Blog.Model.ROYcms_blog> modelList = new List <ROYcms.Blog.Model.ROYcms_blog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ROYcms.Blog.Model.ROYcms_blog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Blog.Model.ROYcms_blog();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["user_id"].ToString() != "")
                    {
                        model.user_id = int.Parse(dt.Rows[n]["user_id"].ToString());
                    }
                    model.tag         = dt.Rows[n]["tag"].ToString();
                    model.Title       = dt.Rows[n]["Title"].ToString();
                    model.Keyword     = dt.Rows[n]["Keyword"].ToString();
                    model.Description = dt.Rows[n]["Description"].ToString();
                    model.content     = dt.Rows[n]["content"].ToString();
                    if (dt.Rows[n]["Time"].ToString() != "")
                    {
                        model.Time = DateTime.Parse(dt.Rows[n]["Time"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(ROYcms.Blog.Model.ROYcms_blog model)
 {
     dal.Update(model);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ROYcms.Blog.Model.ROYcms_blog model)
 {
     return(dal.Add(model));
 }