コード例 #1
0
        public void Delete(AccountChartDocumentViewModel model)
        {
            var entity = model.ToEntity();

            this._accountDocumentRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
コード例 #2
0
        public AccountChartDocumentViewModel Update(AccountChartDocumentViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();

            entity = this._accountDocumentRepository.Update(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return(model);
        }
コード例 #3
0
        public void ThrowExceptionIfExist(AccountChartDocumentViewModel model)
        {
            ConditionFilter <AccountChartDocument, long> condition = new ConditionFilter <AccountChartDocument, long>
            {
                Query = (entity =>
                         entity.Id != model.Id &&
                         entity.AccountChartId == model.AccountChartId &&
                         entity.DocumentId == model.DocumentId)
            };
            var existEntity = this._accountDocumentRepository.Get(condition).FirstOrDefault();

            if (existEntity != null)
            {
                throw new ItemAlreadyExistException();
            }
        }