public virtual async Task <TEntity> Add(TEntity entity)
        {
            try
            {
                var inTransaction = true;
                if (_unitOfWork.Transaction == null)
                {
                    inTransaction = false;
                    _unitOfWork.BeginTransaction();
                }

                var result = await _service.Add(entity, _unitOfWork.Transaction);

                if (!inTransaction)
                {
                    _unitOfWork.Commit();
                }

                return(result);
            }
            catch (Exception e)
            {
                _unitOfWork.Rollback();
                throw e;
            }
        }
        public void PostCategory_Repository_Create()
        {
            PostCategory test1 = new PostCategory();

            test1.Name   = "Test_Case";
            test1.Alias  = "Test_Case";
            test1.Status = true;
            var result = _objRepository.Add(test1);

            _unitOfWord.Commit();

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.ID);
        }
Beispiel #3
0
 public void Save()
 {
     _unitOfWord.Commit();
 }
Beispiel #4
0
 public void SaveChanges()
 {
     _unitOfWord.Commit();
 }