Example #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="dto"></param>
        public void SaveContent(cms_content dto, LoginUserDto loginUser)
        {
            dto.sub_title    = dto.sub_title ?? "";
            dto.summary      = dto.summary ?? "";
            dto.content      = dto.content ?? "";
            dto.author       = dto.author ?? "";
            dto.source       = dto.source ?? "";
            dto.content_href = dto.content_href ?? "";
            dto.cover_image  = dto.cover_image ?? "";
            dto.update_by    = loginUser.LoginName;
            dto.update_time  = DateTime.Now;
            if (dto.id == 0)
            {
                dto.dept_id     = loginUser.DeptId;
                dto.create_by   = loginUser.LoginName;
                dto.create_time = dto.update_time;

                long contentId = Sqldb.Insert(dto).ExecuteIdentity();
                ChannelManagerCache.SetChannelLink(dto.channel_id, (int)contentId);
                //生成文章
                //GenerateContent generate = new GenerateContent();
                //generate.CreateHtml((int)contentId);
            }
            else
            {
                Sqldb.Update <cms_content>().SetSource(dto).ExecuteAffrows();
                //生成文章
                // GenerateContent generate = new GenerateContent();
                //generate.CreateHtml(dto.id);
            }
        }
Example #2
0
        /// <summary>
        ///更新数据
        /// </summary>
        /// <param name="dto"></param>

        public void Update(cms_content dto)
        {
            Sqldb.Update <cms_content>().SetSource(dto)
            .IgnoreColumns(s => new { s.dept_id, s.insert_id, s.channel_id }).ExecuteAffrows();
        }
Example #3
0
        /// <summary>
        ///新增数据
        /// </summary>
        /// <param name="dto"></param>

        public long Insert(cms_content dto)
        {
            long id = Sqldb.Insert(dto).ExecuteIdentity();

            return(id);
        }