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); }
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); }
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); }
public int UpdateCategory(pub_CategoryEntity entity) { return(EFHelper.Update <pub_CategoryEntity>(entity)); }
public int InsertCategory(pub_CategoryEntity entity) { return(EFHelper.Insert <pub_CategoryEntity>(entity)); }