예제 #1
0
        /// <summary>
        /// 新增图文集
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static DocPic CreateDocPic(DocPicEditReqeust info)
        {
            ValiDatas.valiData(info);
            ValiCode(info.Code);
            using (var db = new DefaultContainer()) {
                var       newId  = Guid.NewGuid().ToString();
                Db_DocPic newRow = new Db_DocPic()
                {
                    Caption   = info.Caption,
                    Code      = info.Code,
                    Content   = info.Content,
                    CreatedOn = DateTime.Now,
                    Descript  = info.Descript,
                    DocType   = BaseDocType.图文集.GetHashCode(),
                    Id        = newId
                };
                //所在分类信息

                if (info.TreeIds != null)
                {
                    if (info.TreeIds.Count > 0)
                    {
                        List <Db_BaseDocTree> dbTrees = new List <Db_BaseDocTree>();
                        foreach (var item in info.TreeIds)
                        {
                            dbTrees.Add(new Db_BaseDocTree()
                            {
                                Id           = Guid.NewGuid().ToString(),
                                Db_BaseDocId = newId,
                                TreeId       = item
                            });
                        }
                        db.Db_BaseDocTreeSet.AddRange(dbTrees);
                    }
                }

                db.Db_BaseDocSet.Add(newRow);
                db.SaveChanges();
                return(new DocPic(newRow));
            }
        }
예제 #2
0
 private void SetValue(Db_DocPic row)
 {
     this.Content  = row.Content;
     this.Descript = row.Descript;
 }
예제 #3
0
 /// <summary>
 /// 通过数据库表构造
 /// </summary>
 /// <param name="row"></param>
 public DocPic(Db_DocPic row) : base(row)
 {
     SetValue(row);
 }