public void Delete(AccountChartDocumentViewModel model) { var entity = model.ToEntity(); this._accountDocumentRepository.Delete(entity); #region Commit Changes this._unitOfWork.Commit(); #endregion }
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); }
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(); } }