public bool SaveNode(ArticleNodeModel articleNodeModel, ArticleTreeNodeMapModel articleTreeNodeMapModel, ref string autoNodeCode) { bool tranResult = false; int nextNo = commonRepository.GetNextID(CommonModel.SiteCode, "AN"); // ... Format Article code into 15 digit ... articleNodeModel.Nodecode = "ANC" + CommonModel.SiteCode.ToString().Substring(CommonModel.SiteCode.ToString().Length - 3, 3) + string.Format("{0}", nextNo.ToString().PadLeft(9, '0')); autoNodeCode = articleNodeModel.Nodecode; articleTreeNodeMapModel.Nodecode = articleNodeModel.Nodecode; articleNodeModel.ToAddOrModifyEntity(true); articleTreeNodeMapModel.ToAddOrModifyEntity(true); var articleNode = Mapper.Map(articleNodeModel, new MstArticleNode()); var articleTreeNodeMap = Mapper.Map(articleTreeNodeMapModel, new ArticleTreeNodeMap()); articleNode.ArticleTreeNodeMap = articleTreeNodeMap; tranResult = this.articleHierarchyRepository.SaveNode(articleNode); return(tranResult); }
public bool UpdateNode(ArticleNodeModel articleNodeModel) { bool tranResult = false; articleNodeModel.ToAddOrModifyEntity(true); var articleNode = this.articleHierarchyRepository.GetArticleByID(articleNodeModel.Nodecode); Mapper.Map(articleNodeModel, articleNode); tranResult = this.articleHierarchyRepository.UpdateNode(articleNode); return(tranResult); }