示例#1
0
        public bool EditSubCategory(SubCategoryViewModel model)
        {
            pub_SubCategoryEntity entity = AutoMapHelper.ToEntity <SubCategoryViewModel, pub_SubCategoryEntity>(model);

            if (entity.Id == 0)
            {
                entity.SubCategoryId = IDHelper.Create("S");
                categoryRepository.InsertSubCategory(entity);
            }
            else
            {
                categoryRepository.UpdateSubCategory(entity);
            }
            return(true);
        }
示例#2
0
        public bool EditArticle(ArticleViewModel model)
        {
            ArticleEntity entity = AutoMapHelper.ToEntity <ArticleViewModel, ArticleEntity>(model);

            if (entity.Id == 0)
            {
                entity.ArticleId = IDHelper.Create("A");
                articleRepository.InsertArticle(entity);
            }
            else
            {
                var last = articleRepository.GetArticleById(entity.Id);
                entity.CreateTime = last.CreateTime;
                entity.ArticleId  = last.ArticleId;
                articleRepository.UpdateArticle(entity);
            }
            return(true);
        }