예제 #1
0
        public void InserErrorTest()
        {
            pub_CategoryEntity category = new pub_CategoryEntity();

            category.CategoryName   = "随笔aaaaaaaaaaaaaaaaaaaaaaaaaaaa";
            category.CategoryRemark = "人生的一些感悟";
            category.SortId         = 0;
            Assert.AreEqual(EFHelper.Insert <pub_CategoryEntity>(category), 0);
        }
예제 #2
0
        public void UpdateTest()
        {
            pub_CategoryEntity category = new pub_CategoryEntity();

            category.Id             = 1;
            category.CategoryName   = "随笔11";
            category.CategoryRemark = "人生的一些感悟11";
            category.SortId         = 2;
            Assert.AreEqual(EFHelper.Update <pub_CategoryEntity>(category), 1);
        }
예제 #3
0
        public bool EditCategory(CategoryViewModel model)
        {
            pub_CategoryEntity entity = AutoMapHelper.ToEntity <CategoryViewModel, pub_CategoryEntity>(model);

            if (entity.Id == 0)
            {
                entity.CategoryId = IDHelper.Create("C");
                categoryRepository.InsertCategory(entity);
            }
            else
            {
                categoryRepository.UpdateCategory(entity);
            }
            return(true);
        }
예제 #4
0
 public int UpdateCategory(pub_CategoryEntity entity)
 {
     return(EFHelper.Update <pub_CategoryEntity>(entity));
 }
예제 #5
0
 public int InsertCategory(pub_CategoryEntity entity)
 {
     return(EFHelper.Insert <pub_CategoryEntity>(entity));
 }